Add root path to sys.path in build env for embedded Python #11724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #11670, related issue: python/cpython#100399, Azure/azure-cli#24781
In embedded python, the pyd files are put in root folder.
In standard python, they are put into DLLs folder.
In
build_env.py
, the root folder is excluded by this logic, as root folder is insystem_paths
/system_sites
.pip/src/pip/_internal/build_env.py
Lines 122 to 126 in 07a360d
If these pyd files need to be imported when install new package,
ModuleNotFoundError
is raised.Currently, I find
pwinput
andpendulum
can't be installed in embedded Python.I'm not sure whether this change brings some side effect. Let me know if you have any concern.
Repro step
ModuleNotFoundError: No module named 'pyexpat'
raisesIt can be installed successfully with this PR.