Using python 3.4.3 with pip 8.1.2 on Cygwin / Windows 7.
I want to maintain one updated system-wide pip rather than having to install and upgrade it for every new venv.
The bundled pip is otherwise quite out of date:
$ python3 -c 'import ensurepip; print(ensurepip.version())'
6.0.8
I don't want to maintain any system-wide modules other than pip, rather all dependencies should land in the venv.
I've tried:
$ pyvenv-3.4 --without-pip venv
$ source venv/bin/activate
(venv) $ which pip python
/usr/bin/pip
$HOME/venv/bin/python
Which is what I expect. But then:
(venv) $ export PIP_REQUIRE_VIRTUALENV=true
(venv) $ pip show pip
Could not find an activated virtualenv (required).
Which is quite confounding.
(venv) $ PIP_REQUIRE_VIRTUALENV= pip show pip
---
Metadata-Version: 2.0
Name: pip
Version: 8.1.2
[...]
If I disable PIP_REQUIRE_VIRTUALENV and run pip install MODULE, pip will run, but the MODULE gets installed in my system site-packages, not under venv.
I did figure a workaround by using --system-site-packages:
$ pyvenv-3.4 --without-pip --system-site-packages venv
$ source venv/bin/activate
(venv) $ export PIP_REQUIRE_VIRTUALENV=true
(venv) $ python -c 'import pip; pip.main()' show pip
---
Metadata-Version: 2.0
Name: pip
Version: 8.1.2
I would rather not take the chance of requirements leaking in from system-wide modules. Is there an easier way? Am I wrong to expect the system pip to 'respect my venv'?
There's a similar question here regarding use of PIP_RESPECT_VIRTUALENV and/or --respect-virtualenv but, I find nothing relevant in the current pip sources.