3

I had some problem generating PDF files from reStructuredText, which I thought I could solve with updating rst2pdf.
I got a Permission denied error when I did pip install -U rst2pdf

      OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-6.0.8.dist-info/DESCRIPTION.rst'

$ sudo !!
sudo pip install -U rst2pdf
[sudo] password for root: 
sudo: pip: command not found
$ pip install -U rst2pdf
pip: command not found

How can I solve this, and how to prevent it from happening again?

1

You can try:

easy_install pip

if you have easy_install installed. If not you can download get_pip.py and then do:

python get_pip.py

as documented here

This was caused by the package rst2pdf being (indirectly) depending on pip, combined with that you don't have write permissions on /usr/local on your system. The best structural solution would be to run all such programs from a python virtualenv, but since you would have to add the path to the bin directory of that virtualenv to your PATH, you might break existing programs that rely on the systems python and programs it got installed. So if you try that at least use the system python as base for the virtualenv and do not specify a different interpreter with --python

The lazy solution I have taken on my system, is that I changed the group permission on /usr/local and subdirectories with sudo chgrp -R grpname /usr/local/*. That way I am allowed to write in /usr/local subdirectories as myself.

Of course it would be nice if pip would check up-front if it has the rights to re-install itself before uninstalling itself.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.