2

I am a student and I am doing project on department computer, system Linux 7.2. Now I am trying to install pip so that I can install python packages using it.

I have downloaded get-pip.py and tried to install via python get-pip.py. It gives me:

Collecting pip
Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
 100% |████████████████████████████████| 1.2MB 471kB/s 
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
 100% |████████████████████████████████| 71kB 764kB/s 
Installing collected packages: pip, wheel
Exception:
 Traceback (most recent call last):
 File "/tmp/tmpqybTwL/pip.zip/pip/basecommand.py", line 209, in main
   status = self.run(options, args)
 File "/tmp/tmpqybTwL/pip.zip/pip/commands/install.py", line 317, in run
   prefix=options.prefix_path,
 File "/tmp/tmpqybTwL/pip.zip/pip/req/req_set.py", line 732, in install
   **kwargs
 File "/tmp/tmpqybTwL/pip.zip/pip/req/req_install.py", line 835, in   install
   self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
 File "/tmp/tmpqybTwL/pip.zip/pip/req/req_install.py", line 1030, in move_wheel_files
   isolated=self.isolated,
 File "/tmp/tmpqybTwL/pip.zip/pip/wheel.py", line 344, in move_wheel_files
   clobber(source, lib_dir, True)
 File "/tmp/tmpqybTwL/pip.zip/pip/wheel.py", line 315, in clobber
   ensure_dir(destdir)
 File "/tmp/tmpqybTwL/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
   os.makedirs(path)
 File "/usr/lib64/python2.7/os.py", line 157, in makedirs
   mkdir(name, mode)

OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/pip'

Then, I tried to install using sudo python get-pip.py, however, I got "xxx is not in the sudoers file. This incident will be reported."

So, I was wondering whether I don't have the permission to root and don't have the right to do sudo...but I am not sure about this...

Any suggestion to fix this problem? And in the end, I want to install scipy and gensim.

gladys0313
  • 2,569
  • 6
  • 27
  • 51
  • The first problem: only root can create that directory to install packages system-wide. You probably read online that the solution is to use 'sudo'. However, you can't use 'sudo' to become root because the computer belongs to the school. The administrator manages it, but doesn't grant full control of the system to students. The real solution is to install the packages into your user directory, not system-wide. I don't use pip (though I do use linux and python extensively) so I don't know the answer. – dsh Mar 23 '16 at 16:35
  • @dsh thanks for your comment, so usually how do you install python packages? – gladys0313 Mar 24 '16 at 07:18

3 Answers3

4

Does the system hand you a virtualenv command?

Then you should read about virtualenvs. Comes in handy anyhow.

If not you may use the approach by Jasper van den Bosch

Community
  • 1
  • 1
fupduck
  • 490
  • 4
  • 12
0

You either need to use a virtual environement, and install the pip package in the virtual env. Or install it with pip globally ie system wide as root user

-2

Try install pip using easy_install Try Below commands in terminal:

 sudo su
 easy_install pip
dheeraj .A
  • 1,073
  • 7
  • 6