Reputation: 8660
I installed Anaconda and can run Python, so I assume that I installed it correctly. Following this introductory documentation, I am trying to install Python v3.3, so I am copying and pasting the following line into my console:
conda create -n py33 python=3.3 anaconda
However, that gives me an error:
-bash: conda: command not found
What do I need to do to run Conda?
I am working on a Linux system.
Upvotes: 266
Views: 774994
Reputation: 8960
Using the export PATH=
strategy with conda activate
will result into a warning message for Conda 4.4 or later.
The recommended way (see this release note, and this post) to do it is to remove the export PATH=...
line and instead add the following line in your .bashrc (or .bash_profile
) file:
. ~/anaconda2/etc/profile.d/conda.sh
Furthermore, if you want Conda to be activated by default, add:
conda activate
Upvotes: 4
Reputation: 3720
The main point is that, as of December 2018, it's Scripts
, not bin
.
Use one of these:
export PATH=$USERPROFILE/AppData/Local/Continuum/anaconda2/Scripts/:$PATH
export PATH=$USERPROFILE/AppData/Local/Continuum/anaconda3/Scripts/:$PATH
Use one of these:
SET PATH=%USERPROFILE%\AppData\Local\Continuum\anaconda2\Scripts\;%PATH%
SET PATH=%USERPROFILE%\AppData\Local\Continuum\anaconda3\Scripts\;%PATH%
Change /app
to your installation location. If you installed Anaconda change Miniconda
to Anaconda
. Also, check for Script vs. bin,
export PATH="/app/Miniconda/bin:$PATH"
You may need to run set -a
before setting the path, I think this is important if you're setting the path in a script. For example if you have your export command in a file called set_my_path.sh
, I think you'd need to do set -a; source("set_my_path.sh")
.
The set -a
will make your changes to the path persist for your session, but they are still not permanent.
For a more permanent solution add the command to ~/.bashrc
. The installers may offer to add something like this to your ~/.bashrc
file, but you can do it too (or comment it out to undo it).
Background: I installed the 64-bit versions of Anaconda 2 and 3 recently on my Windows 10 machine following the recommended installation steps in December of 2018.
/bin
folder seems to have been replaced with Scripts
Upvotes: 0
Reputation: 15726
Open your terminal and type the following command to add Anaconda to environment path.
For Anaconda 2:
export PATH=~/anaconda2/bin:$PATH
For Anaconda 3:
export PATH=~/anaconda3/bin:$PATH
Then, to check the Conda version, just type,
conda --version
Create an environment using the following command,
conda create --name myenv
Activate the source using,
source activate myenv
Then your Anaconda IDE is ready!
Upvotes: 1
Reputation: 2368
Similar to the above, remember that you could have Miniconda instead of Conda, so you might want to add
export PATH=${PATH}:/Users/davidfortini/miniconda3/bin
to .zshrc
or .bash_profile
and then reboot the terminal.
Upvotes: -1
Reputation: 77117
conda init
As pointed out in a different answer, manually adding Conda on $PATH
is no longer recommended as of v4.4.0 (see Release Notes). Furthermore, since Conda v4.6 new functionality to manage shell initialization via the conda init
command was introduced. Hence, the updated recommendation is to run
Linux/UNIX and OS X before macOS v10.15 (Catalina)
./anaconda3/bin/conda init
Mac OS X v10.15 (Catalina) and later
./anaconda3/bin/conda init zsh
Windows
./anaconda3/Scripts/conda.exe init
You must launch a new shell or source your init file (e.g., source .bashrc
) for the changes to take effect.
Details. For an in-depth look at exactly what conda init
does see this answer.
You may need to explicitly identify your shell to Conda. For example, if you run zsh
(Mac OS X 10.15+ default) instead of bash
then you would run
./anaconda3/bin/conda init zsh
Please see ./anaconda3/bin/conda init --help
for a comprehensive list of supported shells.
I'd recommend running the above command with a --dry-run|-d
flag and a verbosity (-v
) flag, in order to see exactly what it would do. If you don't already have a Conda-managed section in your shell run commands file (e.g., .bashrc
), then this should appear like a straight-forward insertion of some new lines. If it isn't such a straightforward insertion, I'd recommend clearing any previous Conda sections from $PATH
and the relevant shell initialization files (e.g., bashrc
) first.
Again, for those interested, there is an in-depth look at how it works, in this answer.
Conda v4.6.9 introduced a --reverse
flag that automates removing the changes that are inserted by conda init
.
Upvotes: 61
Reputation: 3375
If you have just installed Anaconda and got this error, then I think you forgot to run this command:
source ~/.bashrc
This will enable you to make use of Anaconda in terminal.
This may seems simple, but many (including me) do this mistake.
If the error is still persisting, you have to verify if anaconda location is added to PATH in your system.
Once you add it, you'll be fine.
Upvotes: 11
Reputation: 4311
Type anaconda-navigator
in the terminal.
Then the Anaconda application will be start.
Upvotes: -1
Reputation: 25
To edit .bashrc in Ubuntu:
/usr/bin/vim ~/.bashrc
Type PATH=$PATH:$HOME/anaconda3/bin
.
Press Esc and :wq
to save the .bashrc file and exit Vim.
Then
export PATH=~/anaconda3/bin:$PATH
And type source ~/.bashrc
.
Now to confirm the installation of Conda, type
conda --version
Upvotes: 1
Reputation: 322
Answer for
~/anaconda3/
, but instead in /anaconda3/
.The PATH
defintion in file .zshrc must therefore be this:
...
# Anaconda3
export PATH="/anaconda3/bin:$PATH"
...
Upvotes: 2
Reputation: 2545
I also was facing the same issue. This might be the simplest possible solution:
source anaconda/bin/activate
For Anaconda 2, use
source anaconda2/bin/activate
Depending on the name of the directory, then execute your command, i.e., conda --create
.
Upvotes: 3
Reputation: 669
I'm on macOS v10.13 (High Sierra) and just installed Anaconda 3 via a Homebrew command. I had an issue with running:
conda
It'd also give me:
-bash: conda: command not found
I tried running:
export PATH=~/anaconda3/bin:$PATH
But it needs entire path. So here are the correct steps:
nano ~/.bash_profile
Now export the entire path. In my case it was:
export PATH=/usr/local/anaconda3/bin:$PATH
Exit out and run:
source ~/.bash_profile
Then try:
conda
For example,
conda --version
Output:
conda 4.4.10
Upvotes: 16
Reputation: 1219
Mostly, it is because when we install Anaconda in the end, it adds the Anaconda path to PATH variable in the .bashrc file.
So we just need to restart the terminal or just do:
source ~/.bashrc
If still it doesn't work, then follow these commands:
cat >> ~/.bashrc
Paste the below command for Anaconda 3:
export PATH=~/anaconda3/bin:$PATH
Hit Enter and then Ctrl + D.
source ~/.bashrc
Upvotes: 6
Reputation: 97
Check where you have installed Anaconda. In my case it looks like /home/nour/anaconda3/bin
Open your .bashrc
file. For example, gedit .bashrc
Add this export PATH = /home/nour/anaconda3/bin:$PATH
line at the end of the file and save.
Reopen the terminal. Type conda --version
Note: Make sure the path in 1. and 3. are the same. In my case, /home/nour/anaconda3/bin
.
Upvotes: 0
Reputation: 1500
My environment: macOS and Anaconda 3
This works for me:
nano ~/.bash_profile
Add this:
export PATH=~/anaconda3/bin:$PATH
The export path must match with the actual path of executable anaconda3
in the system.
Exit out and run:
source ~/.bash_profile
Then try:
jupyter notebook
Upvotes: 28
Reputation: 1152
First, check the location of Anaconda. For me, I installed Anaconda 3 at the /
directory which I access with /anaconda3
.
Then in your terminal, input export PATH="<base location>/anaconda3/bin:$PATH"
. For me, it's export PATH="/anaconda3/bin:$PATH"
.
Finally, input source $/anaconda3/bin/activate
. For you, just change to your location.
Now, you could try conda list
to test.
Also, visit the installation guide.
Upvotes: 0
Reputation: 604
I had the same issue. I removed the Anaconda directory from the install location and reinstalled. After that, it worked as I anticipated.
Upvotes: 0
Reputation: 1582
If you have just installed Miniconda or Anaconda make sure you rerun your terminal.
From this, I mean close and open your terminal and then try conda list to verify your installation.
For me, this worked!!
Upvotes: 1
Reputation: 9
You need to put Anaconda.sh to your /home/<your_name_file>, and then run it to install. After that, you can runexport PATH=~/anaconda3/bin:$PATH
. Remark: do not run Anaconda.sh in download/ directly!
Upvotes: 0
Reputation: 6294
I am setting up a virtual machine running Ubuntu. I have Anaconda 3 installed in the "Home" folder. When I typed "conda" into the terminal I was getting the error "conda: command not found" too.
Typing the code below into the terminal worked for me...
export PATH=$PATH:$HOME/anaconda3/bin
to check it worked I typed:
conda --version
which responded with the version number.
Upvotes: 0
Reputation: 49
System: macOS
I installed Anaconda first, and everything worked well. Then I installed iTerm2 and when I typed Python
, iTerm2 gave me the default Python. Here is how to find your Anaconda Python back:
Open your .zshrc
file. For example, vim ~/.zshrc
Then add export PATH="/Users/yourusername/anaconda2/bin:$PATH"
to the last line of the file. Note that you need to replace the yourusername
to your user name and make sure you have anaconda2. An easy way is to copy this line from ~/.bash_profile
.
Save the file, close it, relaunch the terminal and now Anaconda Python should be back.
Upvotes: 2
Reputation: 81
For Windows:
A recent Anaconda (version 4.4.0) changed some directories. You can find "conda" in Anaconda3/Scripts, instead of Anaconda3/bin.
Upvotes: 8
Reputation: 2747
Run
cat ~/.bash_profile
to check if Anaconda is there. If not, you should add its path there. If Conda is there, copy the entire row that you see the Anaconda there from "export" to the end of line.
Like this:
export PATH=~/anaconda3/bin:$PATH
Run this in your terminal.
Then run
conda --version
to see if it is exported and running!
Upvotes: 2
Reputation: 123
In my case, the Conda path was properly set (in .bashrc) by the Conda installation Bash script. But to make it works I had to give executable file permissions to files in bin sub folder with chmod +x *
.
My system information:
Conda 4.2.9
Operating System: Debian 8 GNU/Linux 8 (Jessie)
Kernel: Linux 3.16.0-4-amd64
Architecture: x86-64
Upvotes: 0
Reputation: 640
Edit ~/.bash_profile, and add this to it.
PATH=$PATH:$HOME/anaconda/bin
Then run
source ~/.bash_profile
Upvotes: 23
Reputation: 2292
For Windows:
PATH=%USERPROFILE%\Continuum\Anaconda4.4.0\Library\bin;%PATH%
Upvotes: -1
Reputation: 287
This information is current as of 2016-08-10. Here are the exact steps I took to fix this using methods posted above. I did not see anyone post: export PATH=$PATH:$HOME/anaconda/bin
(you need to add export to the beginning of the line).
Here it is, step-by-step:
For anyone running into the same problem while using Oh My Zsh, you need to do the following:
Open your .zshrc
in your terminal. I am using iTerm 2 and have Sublime Text 3 as my default text editor:
subl ~/.zshrc
Once the file opens in your text editor, scroll to the very bottom and add:
export PATH=$PATH:$HOME/anaconda/bin
Save the file, then close it.
Close your terminal, then relaunch it.
Once back in your terminal, type:
conda --v
You should then see the version of conda
installed printed on your screen.
If you're using Z shell (executable zsh
), then after doing that, your terminal may show you zsh: command not found: rvm-prompt
.
The solution is:
alias rvm-prompt=$HOME/.rvm/bin/rvm-prompt
within .zshrc
file.source .zshrc
.Then the zsh: command not found: rvm-prompt
will disappear.
Upvotes: 27
Reputation: 1689
If you have installed Anaconda and have definitely said yes
to the:
Do you wish the installer to prepend the Anaconda install location to PATH in your /home/name/.bashrc ? [yes¦no]
question then you maybe just need to restart your terminal window. The change won't take effect until you either (1) close and reopen the current window or (2) just open and start working in a new window
Basically, open a new console window and see if it works now.
Upvotes: 8
Reputation: 4383
You might want to try this:
For Anaconda 2:
export PATH=~/anaconda2/bin:$PATH
For Anaconda 3:
export PATH=~/anaconda3/bin:$PATH
For Anaconda 4:
Use the Anaconda Prompt.
And then
conda --version
to confirm that it worked.
The export PATH=~/anaconda3/bin:$PATH works, but it stops when you exit the terminal in order change that you have to run sudo nano ~/.bashrc and then copy the path into the file and save it after that you activate the changes using source .bashrc.
Check with conda install anaconda-navigator
. If not installed, follow the Anaconda install instructions again
Follow along with the video https://youtu.be/Pr25JlaXhpc.
Upvotes: 435
Reputation: 124
If you have installed Anaconda, but if you are not able to execute a Conda command from the terminal, it means the path is probably not set, try:
export PATH=~/anaconda/bin:$PATH
See this link.
Upvotes: 3
Reputation: 416
If you have installed Anaconda, but you are not able to load the correct versions of Python and IPython, or if you see "conda: command not found" when trying to use Conda, this may be an issue with your PATH environment variable. At the prompt, type:
export PATH=~/anaconda/bin:$PATH
For this example, it is assumed that Anaconda is installed in the default ~/anaconda
location.
Upvotes: 27