Conda command not found
Solution 1
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
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
Maybe you need to execute "source ~/.bashrc"
Solution 4
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
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!
olivrg
Updated on January 25, 2022Comments
-
olivrg over 2 years
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.
-
dlmeetei over 8 yearsInstead of exiting and reopening, Using
source ~/.zshrc
will do -
Thomas Ahle over 6 yearsI tried this, but I still get an error when trying to install stuff
CondaIOError: Missing write permissions in: /anaconda
-
Johnny over 6 yearsIt works! But the path has a slight difference.
export PATH="/Users/victorzhang/anaconda2/bin:$PATH"
, the path beginning is/Users/
, instead of/home/
still thank you @olivrg -
patti_jane over 4 yearsthanks for this! But what is the reason we have to type bash?
-
Kenan over 4 yearsim not 100% sure but I think it's to let your command prompt read the bashrc file
-
bpz over 3 yearsFor those who don't know: copy the command in the
.zshrc
file that will be located in your/User/<yourusername>/
directory. -
Vyacheslav Tsivina over 3 yearsYes, the start script for conda was added inside your .bashrc file during installation, so you need to start bash shell to start the conda
-
maria over 3 yearsMy binary was in condabin at in /usr/local/anaconda3--it's 2021 and I'm on a Mac. I added condabin to the path in .zshrc at /User/<yourusername>/ and it worked.
-
Oha Noch about 3 yearsOn ubuntu i needed to refer to home so i used:
export PATH="~/anaconda3/bin":$PATH
and it worked -
Karan Sharma almost 3 yearsCan you explain what does this command actually do? Thanks!
-
Vinay Verma over 2 years
nano ~/.bashrc
- then in the end addexport PATH="/home/username/miniconda3/bin:$PATH"
Make check if its miniconda or miniconda3source ~./.bashrc
-
frmbelz over 2 yearsAlso instead of close/open terminal, could
source ~/.bashrc
OR. ~/.barshrc
if bash is a shell you are using (to see your shellecho $0
) -
frmbelz over 2 years
echo $0
to see what shell if it is.bashrc
or.zshrc
ORls -ld ~/.*
to see which one is already there. -
Gulzar about 2 yearswhere is
.zshrc
? Is it a mac thing? -
olivrg about 2 years
.zshrc
is the configuration file. You can open it with your text editor using this command:nano ~/.zshrc
-
Hugo M. Zuleta almost 2 years@KaranSharma I believe it resets the environment variables for your profile. If you recently installed Anaconda, that file was edited by the installer with the new env variables, but have not been loaded for conda or other utilities. I might be wrong, I'm new to this whole thing.