Archiv für Oktober, 2013

Rechteprobleme beim Versuch, mit PIP ein paket zu installieren

14. Oktober 2013 von edgar

Heute habe ich versucht, mit Hilfe von PIP das Paket flake8 zu installieren. Leider hat es nicht geklappt, sondern ist mit folgender Fehlermeldung abgebrochen:

$pip install flake8
Downloading/unpacking flake8
Downloading flake8-2.0.tar.gz
Running setup.py egg_info for package flake8

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/lib/python2.7/dist-packages (from flake8)
Downloading/unpacking pyflakes>=0.6.1 (from flake8)
Downloading pyflakes-0.7.3.tar.gz
Running setup.py egg_info for package pyflakes

Downloading/unpacking pep8>=1.4.3 (from flake8)
Downloading pep8-1.4.6.tar.gz (65Kb): 65Kb downloaded
Running setup.py egg_info for package pep8

[...]

no previously-included directories found matching 'docs/_build'
Downloading/unpacking mccabe>=0.2 (from flake8)
Downloading mccabe-0.2.1.tar.gz
Running setup.py egg_info for package mccabe

Installing collected packages: flake8, pyflakes, pep8, mccabe
Running setup.py install for flake8
error: could not create '/usr/local/lib/python2.7/dist-packages/flake8': Permission denied
Complete output from command /usr/bin/python2.7 -c "import setuptools;__file__='/is/ei/eklenske/lib/python2.7/build/flake8/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-nNnRjL-record/install-record.txt:
running install

[...]

running install_lib

creating /usr/local/lib/python2.7/dist-packages/flake8

error: could not create '/usr/local/lib/python2.7/dist-packages/flake8': Permission denied

----------------------------------------
Command /usr/bin/python2.7 -c "import setuptools;__file__='/is/ei/eklenske/lib/python2.7/build/flake8/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-nNnRjL-record/install-record.txt failed with error code 1
Storing complete log in /is/ei/eklenske/.pip/pip.log

So weit, so klar. Es fehlen also die erforderlichen Rechte, um das Paket systemweit installieren zu können. Dummerweise schlug der folgende Versuch, das ganze mit sudo zu bewerkstelligen, ebenfalls Fehl:

sudo pip install flake8
Downloading/unpacking flake8
Running setup.py egg_info for package flake8
error: pip-egg-info/flake8.egg-info/requires.txt: Permission denied
Complete output from command python setup.py egg_info:
running egg_info

writing requirements to pip-egg-info/flake8.egg-info/requires.txt

error: pip-egg-info/flake8.egg-info/requires.txt: Permission denied

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /is/ei/eklenske/.pip/pip.log
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in
load_entry_point('pip==1.0', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 116, in main
return command.main(initial_args, args[1:], options)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 147, in main
log_fp = open_logfile(log_fn, 'w')
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 176, in open_logfile
log_fp = open(filename, mode)
IOError: [Errno 13] Permission denied: '/is/ei/eklenske/.pip/pip.log'

Nach einigem Herumstöbern im Internet bin ich bei stackoverflow auf eine Lösung gestoßen, und zwar im ersten Kommentar: ein einfaches Wechseln in den temporären Ordner mit cd /tmp ist die Lösung. Ein anschließendes sudo pip install flake8 funktioniert dann.

eklenske@irpin: ~ $
cd /tmp
eklenske@irpin: /tmp $
sudo pip install flake8
Downloading/unpacking flake8
Downloading flake8-2.0.tar.gz
Running setup.py egg_info for package flake8

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/lib/python2.7/dist-packages (from flake8)
Downloading/unpacking pyflakes>=0.6.1 (from flake8)
Downloading pyflakes-0.7.3.tar.gz
Running setup.py egg_info for package pyflakes

Downloading/unpacking pep8>=1.4.3 (from flake8)
Downloading pep8-1.4.6.tar.gz (65Kb): 65Kb downloaded
Running setup.py egg_info for package pep8

[...]
no previously-included directories found matching 'docs/_build'
Downloading/unpacking mccabe>=0.2 (from flake8)
Downloading mccabe-0.2.1.tar.gz
Running setup.py egg_info for package mccabe

Installing collected packages: flake8, pyflakes, pep8, mccabe
Running setup.py install for flake8

Installing flake8 script to /usr/local/bin
Running setup.py install for pyflakes

Installing pyflakes script to /usr/local/bin
Running setup.py install for pep8

[...]
no previously-included directories found matching 'docs/_build'
Installing pep8 script to /usr/local/bin
Running setup.py install for mccabe

Successfully installed flake8 pyflakes pep8 mccabe
Cleaning up...



css.php