1

I am trying to install packages via pip. Here some information:

OS = Ubuntu 15.10
python --version = 2.7.10
pip --version = pip 8.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)

So far I have tried with scikit-learn, pyqrcode, and numpy using pip command, none of them was successfully installed. For example with numpy:

pip install numpy

The output is:

Collecting numpy
  Downloading numpy-1.10.4.tar.gz (4.1MB)
    100% |████████████████████████████████| 4.1MB 137kB/s 
Building wheels for collected packages: numpy
Running setup.py bdist_wheel for numpy ... done
Stored in directory: /home/diego/.cache/pip/wheels/66/f5    /d7/f6ddd78b61037fcb51a3e32c9cd276e292343cdd62d5384efd
Successfully built numpy
Installing collected packages: numpy
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 731, in install
    **kwargs
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 841, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 1040, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 343, in move_wheel_files
    clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 314, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 82, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/numpy-1.10.4.dist-info'

Any help? thank you

diegus
  • 487

1 Answers1

3

Try sudo pip install numpy - you can see at the bottom of that output above a 'permission denied' which tells you that your login doesn't have authority to do it, so adopting sudo extra powers fixes it.

  • Yes, It works with sudo. The package is installed. I also get: The directory '/home/diego/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. How to run it without sudo? – diegus Feb 22 '16 at 09:39
  • sudo chown -R diego:diego .cache should fix it - it shouldn't do that! The -H option just makes it use your home as it's home. This tends to be the default (& clearly was on your system) so you can ignore that part. – Mark Williams Feb 22 '16 at 10:05
  • 2
    Using sudo to pip install is not recommended. – vaer-k Aug 24 '17 at 22:19