Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] lenient mode for editable install does not work with the --system-site-packages option of venv #3828

Open
JulienGrv opened this issue Feb 15, 2023 · 0 comments
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@JulienGrv
Copy link

JulienGrv commented 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 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-packages
source 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

@JulienGrv JulienGrv added bug Needs Triage Issues that need to be evaluated for severity and status. labels Feb 15, 2023
@JulienGrv 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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

1 participant