Glam Prestige Journal

Bright entertainment trends with youth appeal.

When I try to pip install any package I'm getting this error:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/numpy'
Consider using the `--user` option or check the permissions.

When I try to sudo pip install anything I'm getting the following error.

Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main
ImportError: cannot import name main
farzand@farzand-linux:~$ 

1 Answer

There are two different pip packages in Ubuntu 18.04: python-pip (for Python 2.x) and python3-pip (for Python 3.x). To install packages that are compatible with the default Python version in 18.04 you need to install python3-pip.

sudo apt install python3-pip

You can also install numpy with either:

sudo apt install python3-numpy # for Python 3.x

or

sudo apt install python-numpy # for Python 2.x in Ubuntu 20.04 and earlier 

Note the python- and python3- convention for prefacing package names of Python 2.x and Python 3.x packages in the default Ubuntu repositories.

How to upgrade pip to latest version?

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy