3

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?

0xSheepdog
  • 2,742
  • 1
  • 20
  • 31
Feyre
  • 133
  • 1
  • 1
  • 6
  • 1
    Try to prefix your command with `sudo `. – Cyrus Oct 20 '14 at 07: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 07:54

1 Answers1

1

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.

Braiam
  • 35,380
  • 25
  • 108
  • 167