Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOError: [Errno 13] Permission denied: '/usr/local/bin/pip' #4186

Closed
ghost opened this issue Dec 17, 2016 · 16 comments
Closed

IOError: [Errno 13] Permission denied: '/usr/local/bin/pip' #4186

ghost opened this issue Dec 17, 2016 · 16 comments
Labels
type: support User Support

Comments

@ghost
Copy link

ghost commented Dec 17, 2016

  • Pip version:1.5.4
  • Python version:2.7.6
  • Operating System:ubuntu 14.04

Description:

How can i solve the following problem:

I was trying to install autograd and scikit-learn, both through pip command. However, both installation failed, with the error
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip'

thus i guess these error may caused by pip, so i test pip with update command 'pip install -U pip ', it replied
IOError: [Errno 13] Permission denied: '/usr/local/bin/pip'

I guess pip on my machine is broken? Any advice is pretty appreciate, thanks.

What I've run:

The log of running command 'pip install -U pip' listed below:

Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.4
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
  Can't roll back pip; was not uninstalled
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 312, in move_wheel_files
    generated.extend(maker.make(spec))
  File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/scripts.py", line 311, in make
    self._make_script(entry, filenames, options=options)
  File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/scripts.py", line 215, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/scripts.py", line 195, in _write_script
    self._fileop.write_binary_file(outname, script_bytes)
  File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/util.py", line 384, in write_binary_file
    with open(path, 'wb') as f:
IOError: [Errno 13] Permission denied: '/usr/local/bin/pip'

Storing debug log for failure in /home/eric/.pip/pip.log

@xavfernandez xavfernandez added the type: support User Support label Dec 18, 2016
@xavfernandez
Copy link
Member

You should add the --user option to install without needing root permission.

@hnykda
Copy link

hnykda commented Jan 13, 2017

Couldn't we add some helpful message for a user? E.g. something like: "if you don't have root permissions, use virtualenv instead?"

E.g. in R-lang you get this:

> install.packages('yaml')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("yaml") :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead?  (y/n) y
Would you like to create a personal library
~/R/x86_64-pc-linux-gnu-library/3.0
to install packages into?  (y/n) y

that would definitely help a lot of beginners...

@pradyunsg
Copy link
Member

@hnykda I've made a PR for improving the error message when this happens (that I should have made a while back) - #4233.

@hnykda
Copy link

hnykda commented Jan 15, 2017

Thanks. I like that.

@alfandindarahmawan
Copy link

go to super user. after that run 'pip install -U pip'

@xavfernandez
Copy link
Member

Closing as there is nothing we can do.
Hopefully #4233 will help reduce the confusion.

@shaopengyuan
Copy link

add --user works! I have tried.

@shitalmule04
Copy link

shitalmule04 commented Sep 27, 2017

What will be the command by adding add --user?

@obestwalter
Copy link

pip install --user <package you want to install>

Also see: https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-user

@shitalmule04
Copy link

Thanks urllib3 installed successfully using pip.

@khamosh-nigahen
Copy link

yes, --user works :)

@saporter
Copy link

Still working! Thanks
pip3 install --user .

@khushubuchandel
Copy link

I have my python script which is retrieving url data and writing to file using below command . When I am running this script on my local machine, it works but running through jenkins gives me error 13.

response = urllib.urlopen(url)
tmpXml = response.read()
with open (/tmp/tempxml1.txt,'wr') as file1:
file1.write(tmpXml)
response.close()

Error displayed on jenkins -
IOError: [Errono 13] Permission denied: '/tmp/tempxml1.txt'

Any mastermind here to help me out

@benoit-pierre
Copy link
Member

@WV-no7 : please don't advise people to use sudo pip, it's very bad practice.

@GoodGuyGregory
Copy link

the python get-pip.py --user command works with Ubuntu 18.04. Will this continue to be an issue for those who don't update python to the latest version? It appears Python 2.7 will be deprecated in 2020..

@Orientier7
Copy link

You should add the --user option to install without needing root permission.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: support User Support
Projects
None yet
Development

No branches or pull requests