[Python-modules-team] Bug#782795:

Gergo Tisza gtisza at wikimedia.org
Wed Sep 23 02:57:47 UTC 2015


What happens, I believe, is that --relocatable prepends some code to all
files in <venv>/bin to run activate_this.py, which in turn changes
sys.prefix (the grandparent directory of Python libraries, normally
something like /usr) to point to the venv and saves the old value in
sys.real_prefix. When you run activate and then you run pip, this code is
called twice, and the second time sys.real_prefix is overwritten with the
old value of sys.prefix which at this point is also the venv. This will
then fail the assertion in pip which verifies that real_prefix points to
the system-wide Python installation.

Workaround is to run pip from the interpreter, without invoking the
executable:

python -c "import pip; pip.main(['install', 'flask'])"

(Running  <venv>/bin/pip while the venv is not activated would probably
work as well.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20150922/ad12e934/attachment.html>


More information about the Python-modules-team mailing list