Ubuntu – I can’t run “sudo” on a certain command, because its not in the sudo path. How to give the right permissions then

permissions

I want to install some Python package using pip. I get a surprising error:

error: could not create '/home/brian/anaconda/lib/python2.7/site-packages/PyDSTool': Permission denied

----------------------------------------
Command "/home/brian/anaconda/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-EIkik9/pydstool/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ipWEV7-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-EIkik9/pydstool

Okay, so apparently, the command doesn't have permission to create a folder in my home directory. Already, this is troublesome to me! I have been having issues with this, and am not sure what to do…

Anyway, doing sudo pip install <package of interest> also doesn't work because:

brian@brian-linux:~$ sudo pip install pydstool
[sudo] password for brian: 
sudo: pip: command not found

So, what now? I would rather not dig into sudoers and manually add in the bin path that sudo doesn't have access to. I would rather that my home directory behave as normal. Perhaps setting up my memory drives (with / on the SSD, and /home mounted on the HDD) was a very bad idea?

Best Answer

Looks like the permissions in your ~/ are messed up. All files there should be owned by you. Use find ~/ -user rootto see if root has taken over some of it, especially the directory’s in the error you posted. Change permissions back to yourself where necessary.

Where did you get "pip" and how was it installed?