0

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?

1

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?

3
  • This answer helped me, as it turned out the that the anaconda directory under my home directory was owned by root (although...I am root, no?). So, I changed the permissions there.
    – user390136
    Apr 12 '15 at 5:19
  • By the way, I got pip by installing the Anaconda environment.
    – user390136
    Apr 12 '15 at 5:21
  • looking at the Anaconda page I see this 'Installs into a single directory and doesn't affect other Python installations on your system. Doesn't require root or local administrator privileges' witch would explane why root cant run it (without starting with a full path command) as the location of the executable is not in the system path. you can see the systems "path" with 'echo $PATH' and set a new entry to the path environment with ' export PATH=$PATH:/opt/games' to add /opt/games for instance. Apr 12 '15 at 17:09
0

I don't know if this will work, but I'd try creating the directory independent of opening or installing your software package.

I really don't know why you shouldn't be able to write to your home directory. It is YOUR home directory, right? Because if you tried to install it to someone else's home directory that would explain it.

Do you just have one Linux installation on your hard drive? If you have more than one it's real easy to get mixed up about which logical drive you're logged in on.

If you do sudo su you will be logged in as root and can do anything you want to - but be careful because it is also much easier to break your system.

1
  • No other linux installations, so I don't think that's the issue. I am not sure why the folder in question became owned by root. Surprisingly, if I use sudo su, then pip becomes totally unknown.
    – user390136
    Apr 12 '15 at 5:20

Your Answer

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