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-pipYou can also install numpy with either:
sudo apt install python3-numpy # for Python 3.xor
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.