Tuesday, February 1, 2022

[SOLVED] does pip install -U break virtualenv?

Issue

I have a virtualenv where I'm running python 2.7.13. I did install numpy a while ago. Today I wanted to install statsmodels as well in the same virtualenv. That's why I did (according to the webpage):

pip install -U statsmodels

and several packages where updated (numpy among others). I forgot that the -U forces to install the newest version. Since numpy was updated to numpy 1.13.3 I'm not sure if this broke a dependency. Is the forced version 1.13.3 not suitable for the virtualenv? If so how can I remove it and install the correct one. If I'm running

pip uninstall numpy

followed by a

pip install numpy

it says:

pip install numpy
Collecting numpy
  Using cached numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.13.3

Solution

Yes, the compatibility with Python is guaranteed: look at the filename of the wheel that is installed: numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl. That matches the Python version you're using (including your OS).

As for statsmodels and the upgraded NumPy: if statsmodels requires numpy 1.13.3, you're fine; that's the whole point of a virtualenv: it doesn't break any other dependencies/virtualenvs you might have set up. It is unlikely you have another package in the same virtualenv that requires a lower version of NumPy.



Answered By - user707650
Answer Checked By - David Marino (WPSolving Volunteer)