0

I have just install anaconda (python 2.7 version) in /usr/local/bin

I added /usr/local/bin/anaconda2/bin/ to the path.

Now when I run conda from the command prompt it runs fine (but can't install anything without sudo because of the directory it's in).

However when I run the same command with sudo it can't find conda.

Does anyone know why this is?

Without sudo:

$ conda
usage: conda [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command

With sudo:

$ sudo conda
sudo: conda: command not found
Zanna
  • 70,465
Grant
  • 382

2 Answers2

2

Try to call conda with its absolute path :

 sudo /path/to/conda

You probably added conda location to your user $path but not to the sudo account

If this works, you can modify the $path for the root user the same way you did for your user

sudo export PATH=$PATH:/usr/local/bin

EDIT : export doesn't work with sudo, but you can change your path in /etc/sudoers (secure_path)

Félicien
  • 1,183
0

I ended up with a similar situation; by trying to update conda it required permissions which I couldn't give because with sudo it didn't appear as well, so I tried to give permissions to my user like this post suggested but with miniconda3 and after running the update again it worked.