Forums

Errors installing a library via pip

Hi I am trying to install a library called Boris via PIP. This worked on my local machine but am getting errors when trying to do it my console. Are you able to help me?

00:20 ~/recharge (master)$ pip install boris
Collecting boris
  Downloading Boris-0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): lxml>=3.0.1 in /usr/local/lib/python2.7/dist-packages (from boris)
Collecting Postcodes>=0.1 (from boris)
  Downloading Postcodes-0.1.tar.gz
Installing collected packages: Postcodes, boris
  Running setup.py install for Postcodes
    error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/postcodes.py'
    Complete output from command /usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fxWyS5/Postcodes/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-txkdVF-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_py

    creating build

    creating build/lib.linux-x86_64-2.7

    copying postcodes.py -> build/lib.linux-x86_64-2.7

    running egg_info

    writing Postcodes.egg-info/PKG-INFO

    writing top-level names to Postcodes.egg-info/top_level.txt

    writing dependency_links to Postcodes.egg-info/dependency_links.txt

    warning: manifest_maker: standard file '-c' not found



    reading manifest file 'Postcodes.egg-info/SOURCES.txt'

    writing manifest file 'Postcodes.egg-info/SOURCES.txt'

    running install_lib

    copying build/lib.linux-x86_64-2.7/postcodes.py -> /usr/local/lib/python2.7/dist-packages

    error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/postcodes.py'

    ----------------------------------------
    Command "/usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fxWyS5/Postcodes/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().re
place('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-txkdVF-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-bu
ild-fxWyS5/Postcodes
19:53 ~/recharge (master)$

Does this help? https://www.pythonanywhere.com/wiki/InstallingNewModules

potentially yes but i can't launch the console to find out - is there a problem with it? thanks

i have managed to install successfully: 13:23 ~/recharge (master)$ pip install --user boris
Collecting boris Using cached Boris-0.1.tar.gz Requirement already satisfied (use --upgrade to upgrade): lxml>=3.0.1 in /usr/local/lib/python2.7/dist-packages (from boris) Collecting Postcodes>=0.1 (from boris) Using cached Postcodes-0.1.tar.gz Installing collected packages: Postcodes, boris Running setup.py install for Postcodes Running setup.py install for boris Successfully installed Postcodes-0.1 boris-0.1

thank you

however my page still won't load: ImportError at / No module named boris Request Method: GET Request URL: http://lz7cjc.pythonanywhere.com/ Django Version: 1.7.1 Exception Type: ImportError Exception Value:
No module named boris Exception Location: /home/lz7cjc/recharge/recharge/views.py in <module>, line 6 Python Executable: /usr/local/bin/uwsgi Python Version: 2.7.6 Python Path:
['/var/www', '.', '', '/var/www', '/home/lz7cjc/.virtualenvs/Django17/lib/python2.7', '/home/lz7cjc/.virtualenvs/Django17/lib/python2.7/plat-x86_64-linux-gnu', '/home/lz7cjc/.virtualenvs/Django17/lib/python2.7/lib-tk', '/home/lz7cjc/.virtualenvs/Django17/lib/python2.7/lib-old', '/home/lz7cjc/.virtualenvs/Django17/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/lz7cjc/.virtualenvs/Django17/local/lib/python2.7/site-packages', '/home/lz7cjc/.virtualenvs/Django17/lib/python2.7/site-packages', '/home/lz7cjc/recharge'] Server time: Fri, 6 Mar 2015 13:29:38 +0000

did you hit 'reload' on your web app?

yes

Ah. Maybe check out the debugging instructions here? https://www.pythonanywhere.com/wiki/DebuggingImportError

i have read through them and am utterly confused! However I tried running the first line in the python console:

python -i /var/www/lz7cjc.pythonanywhere.com_wsgi.py Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'python' is not defined

however i did manage this simple check:

import boris print boris <module 'boris' from '/home/lz7cjc/.local/lib/python2.7/site-packages/boris.pyc'>

so it looks like it is there, but not sure what that means for me getting the thing working

when you run python -i /var/www/lz7cjc.pythonanywhere.com_wsgi.py it should be from a bash console, not a python console!