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

Virtual environments created with venv --system-site-packages can't access binaries from pre-installed packages, neither re-install those packages #118388

Open
blaiseli opened this issue Apr 29, 2024 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@blaiseli
Copy link

blaiseli commented Apr 29, 2024

Bug report

Bug description:

I wanted to "pre-install" in my "source" python installation some packages I often use, so that those packages are readily available in the virtual environments created from this "source", without wasting space and time re-installing them every time I create a new venv.

I thought the --system-site-packages would do just that, however, this "doesn't work" for binaries installed by python packages (for instance, ipython, but I can think of other cases like pylint, flake8 or cookieninja):

I create the venv (using a locally compiled 3.11 version):

bli@latimeria:~/tmp$ ~/python3.11/bin/python3 -m venv --system-site-packages .venv
bli@latimeria:~/tmp$ source .venv/bin/activate

However, the bin directory of the venv does not contain ipython:

(.venv) bli@latimeria:~/tmp$ ls .venv/bin/ | grep ipython

But ipython is installed in the source python 3.11:

(.venv) bli@latimeria:~/tmp$ ls ~/python3.11/bin/ | grep ipython
ipython
ipython3

This is however not in the PATH when in the venv (in this particular case, calling ipython starts one installed with python 3.6 in ${HOME}/bin, whereas if I try with a package not installed anywhere else than in the python 3.11 install, like cookieninja, the command is not found).

This even prevents the installation of ipython in the venv:

(.venv) bli@latimeria:~/tmp$ .venv/bin/pip3 install ipython
Requirement already satisfied: ipython in /home/bli/python3.11/lib/python3.11/site-packages (8.24.0)
[...]
(.venv) bli@latimeria:~/tmp$ .venv/bin/pip3 install --upgrade ipython
Requirement already satisfied: ipython in /home/bli/python3.11/lib/python3.11/site-packages (8.24.0)
[...]

CPython versions tested on:

3.11

Operating systems tested on:

Linux

@blaiseli blaiseli added the type-bug An unexpected behavior, bug, or error label Apr 29, 2024
@blaiseli blaiseli changed the title Virtual environments created with venv --system-site-packages can't access binaries from installed packages, neither re-install those packages Virtual environments created with venv --system-site-packages can't access binaries from pre-installed packages, neither re-install those packages Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant