Dario
Dario

Reputation: 331

Python2: installing networkx

I'm tryng to install networkx on python 2.7.18:

pip2 install networkx

I get the following error:

Running setup.py install for networkx ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"'; _file='"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_, '"'"'exec'"'"'))' install --record /private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-record-cJQmE6/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/networkx
         cwd: /private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/

and in the end:

error: could not create '/Library/Frameworks/Python.framework/Versions/2.7/share/doc/networkx-2.2': Permission denied
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"'; _file='"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_, '"'"'exec'"'"'))' install --record /private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-record-cJQmE6/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/networkx Check the logs for full command output.

What should I do?

Upvotes: 0

Views: 999

Answers (1)

Giorgos Myrianthous
Giorgos Myrianthous

Reputation: 39930

This means that you don't have sufficient privileges.


You can either run the command with sudo (if you are a root user):

sudo pip2 install networkx

or just install it just for the current user

pip2 install networkx --user

PS: Consider upgrading to pip3.


Upvotes: 1

Related Questions