user2183336
user2183336

Reputation: 655

virtualenv pip does not upgrade

My system pip is install in /opt/.../site-packages. It is versio 1.5.6. In a new virtualenv I run pip install -U pip. I see:

...Downloading pip-18.0-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
Not uninstalling pip at /opt/site-packages, outside environment /home/venv
Successfully installed pip
Cleaning up...
 Removing temporary dir /home/venv/build...

But pip -V now still says pip 1.5.6 from /opt/.../site-packages

Both pip and pip2 present in the venv/bin dir show the same. which pip points to the pip in the venv/bin path, so it looks like that pip bin is just never being updated. How do I use the new pip I just installed in my virtual environment?

Upvotes: 2

Views: 3859

Answers (3)

eandersson
eandersson

Reputation: 26342

The problem is that when you create your virtual environment, it will use the packages bundled with that version. If you install a new version of virtualenv you will need to re-create the environment to make use of the new package bundle.

Other alternatives are to manually upgrade the packages within the virtual environment.

Upvotes: 0

user2183336
user2183336

Reputation: 655

Solution was (virtualenv):easy_install -U pip

Upvotes: 2

yorodm
yorodm

Reputation: 4461

Seems that virtualenv is preventing you to access any module outside the virtual environment home. If you want to upgrade your system pip, do it from outside the virtual environment. Anyway when upgrading pip it's better not to call the binary itself. Try this in your virtualenv:

 python -m pip install --upgrade pip

Upvotes: 0

Related Questions