28

I installed Conda using its 32 bits .sh file from here.

Here are the essential parts of the installation procedure that worked fine:

Do you approve the license terms? [yes|no]
[no] >>> yes

Miniconda3 will now be installed into this location:
/home/begueradj/miniconda3

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

[/home/begueradj/miniconda3] >>> 
PREFIX=/home/begueradj/miniconda3
installing: python-3.4.2-0 ...
installing: conda-env-2.0.1-py34_0 ...
installing: openssl-1.0.1k-0 ...
installing: pycosat-0.6.1-py34_0 ...
installing: pyyaml-3.11-py34_0 ...
installing: readline-6.2-2 ...
installing: requests-2.5.1-py34_0 ...
installing: sqlite-3.8.4.1-0 ...
installing: system-5.8-1 ...
installing: tk-8.5.15-0 ...
installing: xz-5.0.5-0 ...
installing: yaml-0.1.4-0 ...
installing: zlib-1.2.8-0 ...
installing: conda-3.8.3-py34_0 ...
Python 3.4.2 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
Do you wish the installer to prepend the Miniconda3 install location
to PATH in your /home/begueradj/.bashrc ? [yes|no]
[no] >>> yes

Prepending PATH=/home/begueradj/miniconda3/bin to PATH in /home/begueradj/.bashrc
A backup will be made to: /home/begueradj/.bashrc-miniconda3.bak


For this change to become active, you have to open a new terminal.

Thank you for installing Miniconda3!
begueradj@begueradj-HP-Compaq-6510b-KE130ET-ABF:~/Desktop$ 

When I type sudo conda install something, I get this error:

sudo: conda: command not found

How can I resolve this problem ?

4 Answers 4

23

Well, I'm not used to find answers to my question this quickly, but for this one I did:

I had only to remove the sudo before the conda command.

Explanation:

All conda commands must be run without super user privileges.

Hope it can help someone in the future.

5
  • 5
    Indeed, this is the right answer. Conda installs in the home directory with user privileges. You should avoid using sudo with conda, as that would write files with non-user permissions, and you would have to use sudo every time thereafter to modify those files.
    – asmeurer
    Feb 23, 2015 at 22:42
  • 5
    If I do this, I get a CondaIOError: Missing write permissions in: /anaconda. Nov 13, 2017 at 13:34
  • @ThomasAhle You should start a new question, you can link this one and specify what exactly you did and what the result was.
    – Melebius
    Jan 8, 2018 at 10:07
  • 1
    In my case I installed I installed conda to opt/anaconda so I now need to run it with sudo. So I fixed it by adding export PATH="/opt/anaconda/bin:$PATH" to my sudo bash Apr 20, 2018 at 17:31
  • 1
    This false. Root permissions are required to edit the base environment when a system-wide install is done.
    – Myridium
    Apr 16, 2021 at 2:46
16

If you are getting a CondaIOError with conda command, it means that the conda directory does not have enough permissions to download and save new libraries.

Just execute these commands in terminal, and you'll be good to go:

sudo chown -R username /home/username/path-to-conda-folder/

sudo chmod -R +x /home/username/path-to-conda-folder/

Change username and path-to-conda-folder according to your PC.

Hope this helps! :)

2
  • FYI - this didn't worked Sep 8, 2020 at 9:39
  • FYI - this did work. Conda installed in /opt/anaconda3.
    – Danyal
    Oct 2, 2023 at 0:10
11

You can do the following Before running the sudo command type

which conda

then use the full conda path

sudo ~/install/ananconda//5.1../etc install myPackageName
4
  • Welcome to Ask Ubuntu! As you can see, this question was asked YEARS ago and already has an accepted answer. Please don't add answers to ancient question which don't give any improvement to the accepted answer. Sep 6, 2018 at 12:44
  • This is a duplicate of this existing answer: askubuntu.com/questions/588497/sudo-conda-command-not-found/…
    – karel
    Sep 6, 2018 at 13:51
  • 1
    Thank you so much. its works for me. Apr 7, 2019 at 19:52
  • worked for me . thanks
    – Masih
    Nov 3, 2021 at 23:40
2

If you decide to run with sudo permissions you shoud run conda specifying explicity the path of the conda executable. That path can ve investigated with which conda.

You must log in to answer this question.