anon_swe
anon_swe

Reputation: 9355

Installing Python Requests

So I'm trying to download requests using pip and am getting the error below. I've checked the error log but it's largely incomprehensible to me.

Any suggestions? I'm getting a similar issue when trying to use pip for beautifulsoup4.

~ ∴ pip install requests
Downloading/unpacking requests
  Downloading requests-2.2.1-py2.py3-none-any.whl (625kB): 625kB downloaded
Installing collected packages: requests
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py", line 279, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 1380, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 664, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 894, in move_wheel_files
    pycompile=self.pycompile,
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/wheel.py", line 202, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/wheel.py", line 189, in clobber
    os.makedirs(destsubdir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests'

Storing debug log for failure in /Users/my_name/Library/Logs/pip.log

Upvotes: 14

Views: 20954

Answers (7)

Vishal Nagpure
Vishal Nagpure

Reputation: 296

If executing pip with sudo, you may want sudo's -H flag.

sudo -H pip install --user requests

Upvotes: 1

M.Joe
M.Joe

Reputation: 21

For Mac OS X :

First install pip by this command :

sudo easy_install pip

Then install requests by this command :

pip install --user requests

Upvotes: 2

TheExorcist
TheExorcist

Reputation: 2006

for ubuntu

sudo apt-get install python-requests

all done!!

Upvotes: 0

Kevin Zhao
Kevin Zhao

Reputation: 2143

If you are in Pycharm, trying to update your requests from 2.5 to 2.7, you will get the same error, I typed the following into my command line:

sudo pip install --upgrade requests

if it asks for your password, just enter the password for your computer

and it worked for me

Upvotes: 0

Stephen Burrows
Stephen Burrows

Reputation: 480

try this:

pip install --user requests

(that's as it's written, you don't have to substitute anything in)

Upvotes: 9

elyase
elyase

Reputation: 41003

This is the important part:

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests'

To install a library system-wide(in that folder) you need root privileges, use sudo:

sudo pip install requests

Alternatively take a look at virtualenv so that you can have different local installations without needing root.

Upvotes: 3

gat
gat

Reputation: 2990

You are trying to install the package in '/Library/Python/2.7/site-packages/requests' but it requires root permissions to do so. This should do the trick:

$ sudo pip install requests

Upvotes: 15

Related Questions