Conda command not found

PythonZshAnacondaMiniconda

Python Problem Overview


I've installed Miniconda and have added the environment variable export PATH="/home/username/miniconda3/bin:$PATH" to my .bashrc and .bash_profile but still can't run any conda commands in my terminal.

Am I missing another step in my setup? I'm using zsh by the way.

Python Solutions


Solution 1 - Python

If you're using zsh and it has not been set up to read .bashrc, you need to add the Miniconda directory to the zsh shell PATH environment variable. Add this to your .zshrc:

export PATH="/home/username/miniconda/bin:$PATH"

Make sure to replace /home/username/miniconda with your actual path.

Save, exit the terminal and then reopen the terminal. conda command should work.

Solution 2 - Python

If you have the PATH in your .bashrc file and are still getting

conda: command not found

Your terminal might not be looking for the bash file. Type bash in the terminal to ensure you are in bash and then try: conda --version

Solution 3 - Python

Maybe you need to execute "source ~/.bashrc"

Solution 4 - Python

For those experiencing issues after upgrading to MacOS Catalina.

Short version:

# 1a) Use tool: conda-prefix-replacement - 
# Restores: Desktop -> Relocated Items -> Security -> anaconda3
curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr
./cpr rehome ~/anaconda3
# or if fails
#./cpr rehome ~/anaconda3 --old-prefix /Anaconda3
source ~/anaconda3/bin/activate

# 1b) Alternatively - reintall anaconda - 
# brew cask install anaconda

# 2) conda init
conda init zsh
# or
# conda init    

Further reading - Anaconda blog post and Github discussion.

Solution 5 - Python

Sometimes, if you don't restart your terminal after you have installed anaconda also, it gives this error.

Close your terminal window and restart it.

It worked for me now!

Solution 6 - Python

Maybe you should type add this to your .bashrc or .zshrc

export PATH="/anaconda3/bin":$PATH

It worked for me.

Solution 7 - Python

To initialize your shell run the below code

source ~/anaconda3/etc/profile.d/conda.sh
conda activate Your_env

It's Worked for me, I got the solution from the below link
https://www.codegrepper.com/code-[“CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.][1]examples/shell/CommandNotFoundError%3A+Your+shell+has+not+been+properly+configured+to+use+%27conda+activate%27.+To+initialize+your+shell%2C+run

Solution 8 - Python

conda :command not found

Try adding below line to your .bashrc file

export PATH=~/anaconda3/bin:$PATH

then try:

conda --version

to see version

and then to take affect

conda init 

Solution 9 - Python

Execute the following command after installing and adding to the path

source ~/.bashrc

where source is a bash shell built-in command that executes the content of the file passed as argument, in the current shell.

It runs during boot up automatically.

Solution 10 - Python

I had the same issue. I just closed and reopened the terminal, and it worked. That was because I installed anaconda with the terminal open.

Solution 11 - Python

I faced this issue on my mac after updating conda. Solution was to run conda mini installer on top of existing conda setup.

$ curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3.sh
$ bash ~/miniconda3.sh -bfp ~/miniconda3

On linux, you can use:

$ curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o ~/miniconda3.sh
$ bash ~/miniconda3.sh -bfp ~/miniconda3

For other versions, you can go to https://repo.continuum.io/miniconda/

For details check: https://github.com/conda/conda/issues/1364

Solution 12 - Python

Make sure that you are installing the Anaconda binary that is compatible with your kernel. I was in the same situation.Turned out I have an x64_86 CPU and was trying to install a 64 bit Power 8 installer.You can find out the same for your CPU by using the following command.It gives you a basic information about a computer's software and hardware.-

$ uname -a

https://www.anaconda.com/download/#linux

The page in the link above, displays 2 different types of 64-Bit installers -

  • 64-Bit (x86) installer and

  • 64-Bit (Power 8) installer.

Solution 13 - Python

export PATH="~/anaconda3/bin":$PATH

Solution 14 - Python

The brute-force way could be

if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/root/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/root/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/root/miniconda3/bin:$PATH"
    fi
fi

Then initialize and test Conda.

conda init
conda -V

Which is what Conda tries to do. Take a look at the end of ~/.bashrc with less ~/.bashrc or with cat ~/.bashrc

Solution 15 - Python

I had to run the following command to activate the shell:

eval "$(/home/username/anaconda3/bin/conda shell.bash hook)"

Solution 16 - Python

Do the same thing as the suggestion given by bash console, but pay attention that there are some errors in the suggestion (the file path format is incorrect). Paste these two commands in the bash console for windows:

echo ". C:/Users/mingm/Anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc

and

echo "conda activate" >> ~/.bashrc

After having pasted these two commands, exit the bash console, reload it and then activate the virtual environment by entering "conda activate your_env_name".

Solution 17 - Python

It can be a silly mistake, make sure that you use anaconda3 instead of anaconda in the export path if you installed so.

Solution 18 - Python

For Conda > 4.4 follow this:

$ echo ". /home/ubuntu/miniconda2/etc/profile.d/conda.sh" >> ~/.bashrc

then you need to reload user bash so you need to log out:

exit

and then log again.

Solution 19 - Python

This worked for me on CentOS and miniconda3. Find out which shell you are using

echo $0

conda init bash (could be conda init zsh if you are using zsh, etc.) - this adds a path to ~/.bashrc

Reload command line

sourc ~/.bashrc OR . ~/.bashrc

Solution 20 - Python

I have encountered this problem lately and I have found a solution that worked for me. It is possible that your current user might not have permissions to anaconda directory, so check if you can read/write there, and if not, then change the files owner by using chown.

Solution 21 - Python

MacOSX: cd /Users/USER_NAME/anaconda3/bin && ./activate

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionolivrgView Question on Stackoverflow
Solution 1 - PythonolivrgView Answer on Stackoverflow
Solution 2 - PythonKenanView Answer on Stackoverflow
Solution 3 - PythondewView Answer on Stackoverflow
Solution 4 - PythonxgMzView Answer on Stackoverflow
Solution 5 - PythonSanreetView Answer on Stackoverflow
Solution 6 - PythonSethView Answer on Stackoverflow
Solution 7 - PythonthrinadhnView Answer on Stackoverflow
Solution 8 - PythonBharath KumarView Answer on Stackoverflow
Solution 9 - PythonGursewak SinghView Answer on Stackoverflow
Solution 10 - PythonGolddyView Answer on Stackoverflow
Solution 11 - PythonJeevanView Answer on Stackoverflow
Solution 12 - PythonTaaniView Answer on Stackoverflow
Solution 13 - PythonChrisGClarkView Answer on Stackoverflow
Solution 14 - PythonEcho9kView Answer on Stackoverflow
Solution 15 - PythonData MasteryView Answer on Stackoverflow
Solution 16 - PythonMingming QiuView Answer on Stackoverflow
Solution 17 - PythonBalintView Answer on Stackoverflow
Solution 18 - PythonjobimaView Answer on Stackoverflow
Solution 19 - PythonfrmbelzView Answer on Stackoverflow
Solution 20 - Pythonk-krakowskiView Answer on Stackoverflow
Solution 21 - PythonRyan CocuzzoView Answer on Stackoverflow