Martín Nieva
Martín Nieva

Reputation: 504

Why numpy doesn't appear in my pip3 list within my virtualenv, even though I installed it doing pip3 install numpy two seconds before?

I created a virtualenv. Then I proceeded to activate it. Once activated, I installed numpy through sudo pip3 install numpy.

Once finished installing, I did pip3 list and numpy was not in the list.

Why?

Upvotes: 2

Views: 234

Answers (1)

willeM_ Van Onsem
willeM_ Van Onsem

Reputation: 477210

Short answer: do not use sudo pip3 but pip3. In fact never use sudo pip3.

If you want to use the pip of the virtual environment, you should not use sudo. In fact by using sudo, you bypass the virtual environment, and you will install the package system-wide, since sudo gets as argument pip3, and the virtual environment is not capable of "injecting" the local pip3.

You thus should simply run this as:

pip3 install numpy

Besides not installing it in the local environment, using sudo pip3 is a serious security threat. It means that you will run setup.py as a root user, and thus a malicious package can damage your system. See What are the risks of running sudo pip? for more information.

Upvotes: 2

Related Questions