You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
venv has an option called --system-site-packages which means that when you are in a virtual environment, you can still import and use a package from your system if it is absent in your venv. In the case a package is both installed on the system and in the venv, the one in the venv has precedence over the one from the system. However, since the introduction of the new default lenient mode for editable install, this does not work as expected and the package from the system is used instead of the one in the venv. Currently, this issue can be worked around using editable_mode=compat.
Expected behavior
The package in venv should have precedence over the one in system. Finder script should map to the package in venv, not in system.
How to Reproduce
pip install <package_x># install package_x on your system
python -m venv --system-site-packages venv # create venv with --system-site-packagessource venv/Scripts/activate # activate venv
pip install --editable <path_to_package_x># install package_x in venv with --editable
python -m package_x # will run package_x from system instead of from venv
cat venv/Lib/site-packages/__editable___package_x_finder.py | grep 'MAPPING ='# will show you that it wrongly maps to the package in system instead of venv
pip install --editable <path_to_package_x> --config-settings editable_mode=compat # workaround using compat mode
python -m package_x # will correctly run package_x from venv
PS: please do not remove the compat mode as long as the lenient mode is not fully functioning
The text was updated successfully, but these errors were encountered:
JulienGrv
changed the title
[BUG] lenient mode for editable install does not work with the --system-site-packages option of venv/virtualenv
[BUG] lenient mode for editable install does n with the --system-site-packages option of venv
Feb 15, 2023
JulienGrv
changed the title
[BUG] lenient mode for editable install does n with the --system-site-packages option of venv
[BUG] lenient mode for editable install does not work with the --system-site-packages option of venv
Feb 15, 2023
setuptools version
setuptools==67.1.0
Python version
Python 3.8.16
OS
Windows
Additional environment information
No response
Description
venv has an option called
--system-site-packages
which means that when you are in a virtual environment, you can still import and use a package from your system if it is absent in your venv. In the case a package is both installed on the system and in the venv, the one in the venv has precedence over the one from the system. However, since the introduction of the new default lenient mode for editable install, this does not work as expected and the package from the system is used instead of the one in the venv. Currently, this issue can be worked around usingeditable_mode=compat
.Expected behavior
The package in venv should have precedence over the one in system. Finder script should map to the package in venv, not in system.
How to Reproduce
The text was updated successfully, but these errors were encountered: