Virtual environments created with `venv --system-site-packages` can't access binaries from pre-installed packages, neither re-install those packages
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Problem mit python -m venv --system-site-packages, der Aktivierung und Paketen wie ipython oder cookieninja, die im Quell-Python installiert sind. Vergleiche den venv-PATH sowie das Verhalten von pip install oder beim Aktualisieren; abgeschlossen ist die Aufgabe, wenn der erwartete Zugriff auf die Binärdateien der vorinstallierten Pakete und das Installationsverhalten von Paketen verifiziert sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100