1

I just installed Ubuntu. I downloaded the anaconda python package and am trying to install it,

bash Anaconda-2.1.0-Linux-x86_64.sh

at some point the terminal says:

Anaconda will now be installed into this location:
/home/*username*/anaconda

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify an different location below

So I wanted to install in /opt (which I heard was an appropriate directory), but the terminal then says:

mkdir: cannot create directory ‘/opt/anaconda’:Permission denied
ERROR: Could not create directory: /opt/anaconda

I don't see how I can use sudo here as the installer runs then mkdir. I tried making the directory myself first, bit then it gives the fact that the dir exists as an error. What can I do?

  • 1
    Try to prefix your command with sudo . – Cyrus Oct 20 '14 at 7:01
  • @Cyrus I can't, I have to fill in the directory I want to use, so with sudo this'd be >sudo /opt/anaconda At this point the terminal complains that directories can't have spaces in them, i.e. it sees Sudo as part of the directory I'm trying to install Anaconda in. – Feyre Oct 20 '14 at 7:54
0

So I wanted to install in /opt

The /opt directory is root owned, normal users can't write in it. As long as you tell anaconda that you want to install in directories that non-root users cannot write, you must use elevated privileges. When you start the installer, you must use sudo from the start:

sudo bash Anaconda-2.1.0-Linux-x86_64.sh
[...]
Anaconda will now be installed into this location:
/home/user/anaconda

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify an different location below

[/home/user/anaconda] >>> /opt/anaconda

Anaconda doesn't write anything before that, so you can rest assured.

  • I thought sudo only works with the initial command, but this works. – Feyre Oct 20 '14 at 10:08
  • sudo gets inherited by every subprocess. – asmeurer Oct 22 '14 at 17:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.