Why Anaconda does not recognize conda command? - python

I installed the latest version of Anaconda.
Now I want to install OpenCV within it. When I type:
conda install -c https://conda.binstar.org/anaconda opencv
I get this message error: "conda is not recognized as internal command ..." (sorry, I try to translate from French because my OS is in French)
The problem is that conda comes with Anaconda, so I wonder why lauching Anaconda and type the above command does not work ?

For Windows
Go to Control Panel\System and Security\System\Advanced System Settings then look for Environment Variables.
Your user variables should contain Path=Path\to\Anaconda3\Scripts.
You need to figure where your Anaconda3 folder is (i.e. the path to this folder) . Mine was in C:\Users.
For Linux
You need to add conda to PATH. To do so, type:
export PATH=/path/to/anaconda3/bin:$PATH.
Same thing, you need to figure the path to anaconda3 folder (Usually, the path is stored in $HOME)
If you don't want to do this everytime you start a session, you can also add conda to PATH in your .bashrc file:
echo 'export PATH=/path/to/anaconda3/bin:$PATH' >> ~/.bashrc

I had a similar problem. I searched conda.exe and I found it on Scripts folder. So, In Anaconda3 you need to add two variables to PATH. The first is Anaconda_folder_path and the second is Anaconda_folder_path\Scripts

When you install anaconda on windows now, it doesn't automatically add Python or Conda to your path so you have to add it yourself.
If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt
Next, you can add Python and Conda to your path by using the setx command in your command prompt.
Next close that command prompt and open a new one. Congrats you can now use conda and python
Source: https://medium.com/#GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444

I had a similar problem and I did something like the below mentioned steps with my Path environment variable to fix the problem
Located where my Anaconda3 was installed. I run Windows 7. Mine is located at C:\ProgramData\Anaconda3.
Open Control Panel - System - Advanced System Settings, under Advanced tab click on Environment Variables.
Under System Variables, located "Path" add the following: C:\ProgramData\Anaconda3\Scripts;C:\ProgramData\Anaconda3\;
Save and open new terminal.
type in "conda". It worked for me.
Hope these steps help

You probably need to update your PATH variable to include where you have installed Anaconda.
See https://github.com/ContinuumIO/anaconda-issues/issues/41 for a similar issue.

I suspect you forget to export PATH, anaconda/bin must be added in your $PATH. (Linux, OSX common problem). On Windows make sure you run install and commands as administrator.

Same problem with Anaconda running on Ubuntu 15.10. I closed the terminal and opened a new window and it worked fine.

Faced the same problem running on Windows 10 and using the Windows cmd.
Solved it by running the following command in the Anaconda Prompt which comes with Anaconda3 (as administrator):
conda install -c menpo opencv3=3.1.0
Command found on the official website: https://anaconda.org/menpo/opencv3

Try setting the file path using (for anaconda3)...
export PATH=~/anaconda3/bin:$PATH
Then check whether it worked with...
conda --version
This worked for me when 'conda' was returning 'command not found'.

Try restarting the terminal, I had the same issue, worked after restarting the terminal.

If this problem persists, you may want to check all path values in the PATH variable (under Control Panel\System and Security\System\Advanced System Settings). It might be that some other path is invalid or contains an illegal character.
Today, I had the same problem and found a double quote in a different path value in the PATH variable. All paths after that (including a fresly installed conda) were not usable. Removing the double quote solved the problem.

In Windows 10, I went to the folder where Anaconda is stored. In my case it is in \Anaconda3 folder as a shortcut to open a command prompt window, called "Anaconda Prompt". Open that and execute the command there.

Got same issue and it turns out that besides setting PATH variable, I also should not close some cmd window poped up during installation. Re-installation would work

It's not recommended to add conda.exe path directly into the System Environment Variables at stated by anaconda installer :
For Windows Users, Open Conda Prompt Shortcut and change the Target into the Correct Address :

As other users said, the best way for Windows users is to set the global environment variable.
I install the Miniconda3 for MXNet.
Before I do something, only Anaconda Prompt works for conda.
After setting the global environment variable, The CMD and Git Bash work.
But in some IDEs like RStudio, the nested Git Bash doesn't work.
After restarting my computer, the Git Bash in the RStudio works for conda.
I hope these tests helps for you.

On Windows 11 x64, default is
"C:\ProgramData\Anaconda3\Scripts\conda.exe"
CMD, run, systempropertiesadvanced , add to PATH variable.

Related

Basic python commands no longer recognised in VS Code [duplicate]

I installed Anaconda3 4.4.0 (32 bit) on my Windows 7 Professional machine and imported NumPy and Pandas on Jupyter notebook so I assume Python was installed correctly. But when I type conda list and conda --version in command prompt, it says conda is not recognized as internal or external command.
I have set environment variable for Anaconda3; Variable Name: Path, Variable Value: C:\Users\dipanwita.neogy\Anaconda3
How do I make it work?
I was faced with the same issue in windows 10, Updating the environment variable following steps, it's working fine.
I know It is a lengthy answer for the simple environment setups, I thought it's may be useful for the new window 10 users.
1) Open Anaconda Prompt:
2) Check Conda Installed Location.
where conda
3) Open Advanced System Settings
4) Click on Environment Variables
5) Edit Path
6) Add New Path
C:\Users\RajaRama\Anaconda3\Scripts
C:\Users\RajaRama\Anaconda3
C:\Users\RajaRama\Anaconda3\Library\bin
7) Open Command Prompt and Check Versions
8) After 7th step type
conda install anaconda-navigator in cmd then press y
Although you were offered a good solution by others I think it is helpful to point out what is really happening. As per the Anaconda 4.4 changelog, https://docs.anaconda.com/anaconda/reference/release-notes/#what-s-new-in-anaconda-4-4:
On Windows, the PATH environment variable is no longer changed by default, as this can cause trouble with other software. The recommended approach is to instead use Anaconda Navigator or the Anaconda Command Prompt (located in the Start Menu under “Anaconda”) when you wish to use Anaconda software.
(Note: recent Win 10 does not assume you have privileges to install or update. If the command fails, right-click on the Anaconda Command Prompt, choose "More", chose "Run as administrator")
This is a change from previous installations. It is suggested to use Navigator or the Anaconda Prompt although you can always add it to your PATH as well. During the install the box to add Anaconda to the PATH is now unchecked but you can select it.
I found the solution.
Variable value should be C:\Users\dipanwita.neogy\Anaconda3\Scripts
When you install anaconda on windows now, it doesn't automatically add Python or Conda to your path.
While during the installation process you can check this box, you can also add python and/or python to your path manually (as you can see below the image)
If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt
where python
where conda
Next, you can add Python and Conda to your path by using the setx command in your command prompt (replace C:\Users\mgalarnyk\Anaconda2 with the results you got when running where python and where conda).
SETX PATH "%PATH%;C:\Users\mgalarnyk\Anaconda2\Scripts;C:\Users\mgalarnyk\Anaconda2"
Next close that command prompt and open a new one. Congrats you can now use conda and python
Source: https://medium.com/#GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444
Just to be clear, you need to go to the controlpanel\System\Advanced system settings\Environment Variables\Path,
then hit edit and add:
C:Users\user.user\Anaconda3\Scripts
to the end and restart the cmd line
In addition to adding C:\Users\yourusername\Anaconda3 and C:\Users\yourusername\Anaconda3\Scripts, as recommended by Raja (above), also add C:\Users\yourusername\Anaconda3\Library\bin to your path variable. This will prevent an SSL error that is bound to happen if you're performing this on a fresh install of Anaconda.
If you have a newer version of the Anaconda Navigator, open the Anaconda Prompt program that came in the install. Type all the usual conda update/conda install commands there.
I think the answers above explain this, but I could have used a very simple instruction like this. Perhaps it will help others.
Go To anaconda prompt(type "anaconda" in search box in your laptop). type following commands
where conda
add that location to your environment path variables. Close the cmd and open it again
This problem arose for me when I installed Anaconda multiple times. I was careful to do an uninstall but there are some things that the uninstall process doesn't undo.
In my case, I needed to remove a file Microsoft.PowerShell_profile.ps1 from ~\Documents\WindowsPowerShell\. I identified that this file was the culprit by opening it in a text editor. I saw that it referenced the old installation location C:\Anaconda3\.
For conda --version greater than 4.6, from the base of your Anaconda promt, run
conda update conda
conda init
This will update your conda root environment and setup the stuff you need to run it on both cwd and powershell.
After this, you can start any terminal and it will be conda ready.
If you don't want to add Anaconda to env. path and you are using Windows try this:
Open cmd;
Type path to your folder instalation. It's something like:
C:\Users\your_home folder\Anaconda3\Scripts
Test Anaconda, for exemple type conda --version.
Update Anaconda: conda update conda or conda update --all or conda update anaconda.
Update Spyder:
conda update qt pyqt
conda update spyder
I have Windows 10 64 bit, this worked for me,
This solution can work for both (Anaconda/MiniConda) distributions.
First of all try to uninstall anaconda/miniconda which is causing problem.
After that delete '.anaconda' and '.conda' folders from 'C:\Users\'
If you have any antivirus software installed then try to exclude all the folders,subfolders inside 'C:\ProgramData\Anaconda3\' from
Behaviour detection.
Virus detection.
DNA scan.
Suspicious files scan.
Any other virus protection mode.
*(Note: 'C:\ProgramData\Anaconda3' this folder is default installation folder, you can change it just replace your excluded path at installation destination prompt while installing Anaconda)*
Now install Anaconda with admin privileges.
Set the installation path as 'C:\ProgramData\Anaconda3' or you can specify your custom path just remember it should not contain any white space and it should be excluded from virus detection.
At Advanced Installation Options you can check "Add Anaconda to my PATH environment variable(optional)" and "Register Anaconda as my default Python 3.6"
Install it with further default settings. Click on finish after done.
Restart your computer.
Now open Command prompt or Anaconda prompt and check installation using following command
conda list
If you get any package list then the anaconda/miniconda is successfully installed.
I have just launched anaconda-navigator and run the conda commands from there.
For those who didn't check "Add Anaconda to my PATH environment variable". In Windows 10 it looks like that:
5 paths:
C:\Users\shtosh\anaconda3
C:\Users\shtosh\anaconda3\Library\mingw-w64\bin
C:\Users\shtosh\anaconda3\Library\usr\bin
C:\Users\shtosh\anaconda3\Library\bin
C:\Users\shtosh\anaconda3\Scripts
if you use chocolatey, conda is in C:\tools\Anaconda3\Scripts
I had this problem in windows. Most of the answers are not as recommended by anaconda, you should not add the path to the environment variables as it can break other things. Instead you should use anaconda prompt as mentioned in the top answer.
However, this may also break. In this case right click on the shortcut, go to shortcut tab, and the target value should read something like:
%windir%\System32\cmd.exe "/K" C:\Users\myUser\Anaconda3\Scripts\activate.bat C:\Users\myUser\Anaconda3

Anaconda Prompt (py27) can't find where conda is located

I am a newbie for Python and I've found Spyder way too complicated to make it work. Since my default Spyder's Python version was 3+, I couldn't use the guide that I've found so I installed Spyder for Python 2.7 somehow. Now I need to install scikit-image but Anaconda prompt doesn't recognize "conda" commands.
So I've found that I should check where conda is located first but the prompt cannot even find where conda is so I wanted to ask it to people here.
The left one is for default, the right one is for py27.
enter image description here
Make sure to add Anaconda path to your environment variables.
Your steps will most likely be:
Windows: In your environment variables add C:\Users\[Your Username]\Anaconda3\Scripts to Path.
Ubuntu: edit your .bashrc and add export PATH=~/anaconda3/bin:$PATH
A shortcut to opening env. vars. in Windows: Open up your cmd and type:
rundll32 sysdm.cpl,EditEnvironmentVariables
(Posted on behalf of the question author).
Adding Anaconda3 and Anaconda3\Scripts paths to Path variable in the user variables has solved the problem.

Add conda to my environment variables or path?

I am having trouble adding conda to my environment variables on windows. I installed anaconda 3 though I didn't installed python, so neither pip or pip3 is working in my prompt. I viewed a few post online but I didn't find anything regarding how to add conda to my environment variables.
I tried to create a PYTHONPATH variable which contained every single folder in Anaconda 3 though it didn't worked.
My anaconda prompt isn't working too. :(
so...How do I add conda and pip to my environment variables or path ?
You can access to conda and pip directly in their directory :
On Windows : %ANACONDA_INSTALL_DIR%\Scripts, you will find conda.exe and pip.exe
On Linux : $ANACONDA_INSTALL_DIR/bin, there are conda and pip executable files.
Where $ANACONDA_INSTALL_DIR is the directory of your Anaconda installation.
To add Anaconda to your path, you can add this folder to your PATH.
For Linux, you can add this line to yout .bashrc file
export PATH=$ANACONDA_INSTALL_DIR/bin:$PATH
As said #BcK, reinstalling Anaconda and choosing to add Anaconda to your path is also a way to do this. This option makes a backup of your .bashrc file and add the export line.
EDIT
To open a terminal with the conda environment activated on Windows, I usually create a desktop shortcut with the following target :
%windir%\System32\cmd.exe "/K" %ANACONDA_INSTALL_DIR%\Scripts\activate.bat %ANACONDA_INSTALL_DIR%
Thanks guys for helping me out. I solved the problem reinstalling anaconda (several times :[ ), cleaning every log and resetting the path variables via set path= in the windows power shell (since I got some problems reinstalling anaconda adding the folder to PATH[specifically "unable to load menus" or something like that])

Activating Anaconda Environment in VsCode

I have Anaconda working on my system and VsCode working, but how do I get VsCode to activate a specific environment when running my python script?
Simply use
shift + cmd + P
Search Select Interpreter
Select it and it will show you the list of your virtual environment created via conda and other python versions
select the environment and you are ready to go.
Quoting the 'Select and activate an environment' docs
Selecting an interpreter from the list adds an entry for python.pythonPath with
the path to the interpreter inside your Workspace Settings.
If Anaconda is your default Python install then it just works if you install the Microsoft Python extension.
The following should work regardless of Python editor or if you need to point to a specific install:
In settings.json edit python.path with something like
"python.pythonPath": "C:\\Anaconda3\\envs\\py34\\python.exe"
Instructions to edit settings.json
Setting python.pythonPath in VSCode's settings.json file doesn't work for me, but another method does. According to the Anaconda documentation at Microsoft Visual Studio Code (VS Code):
When you launch VS Code from Navigator, VS Code is configured to use the Python interpreter in the currently selected environment.
The best option I found is to set the python.venvPath parameter in vscode settings to your anaconda envs folder.
"python.venvPath": "/Users/[...]/Anaconda3/envs"
Then if you bring up the command palette (ctl + shift + P on windows/linux, cmd + shift + P on mac) and type Python: Select Workspace Interpreter all your envs will show up and you can select which env to use.
The python extension will also need to be installed for the Select Workspace Interpreter option.
Note: The Select Workspace Interpreter takes around 10 seconds to come up on my computer using the current version of VSCode.
Although approved answer is correct, I want to show a bit different approach (based on this answer).
Vscode can automatically choose correct anaconda environment if you start vscode from it. Just add to user/workspace settings:
{
"python.pythonPath": "C:/<proper anaconda path>/Anaconda3/envs/${env:CONDA_DEFAULT_ENV}/python"
}
It works on Windows, macOS and probably Unix. Further read on variable substitution in vscode: here.
Unfortunately, this does not work on macOS. Despite the fact that I have export CONDA_DEFAULT_ENV='$HOME/anaconda3/envs/dev' in my .zshrc and "python.pythonPath": "${env.CONDA_DEFAULT_ENV}/bin/python",
in my VSCode prefs, the built-in terminal does not use that environment's Python, even if I have started VSCode from the command line where that variable is set.
Just launch the VS Code from the Anaconda Navigator. It works for me.
Find a note here: https://code.visualstudio.com/docs/python/environments#_conda-environments
As noted earlier, the Python extension automatically detects existing
conda environments provided that the environment contains a Python
interpreter. For example, the following command creates a conda
environment with the Python 3.4 interpreter and several libraries,
which VS Code then shows in the list of available interpreters:
conda create -n env-01 python=3.4 scipy=0.15.0 astroid babel
In contrast, if you fail to specify an interpreter, as with conda create
--name env-00, the environment won't appear in the list.
If you need an independent environment for your project:
Install your environment to your project folder using the --prefix option:
conda create --prefix C:\your\workspace\root\awesomeEnv\ python=3
In VSCode launch.json configuration set your "pythonPath" to:
"pythonPath":"${workspaceRoot}/awesomeEnv/python.exe"
Python Path is now deprecated and now you should set Conda Path instead. This way you can pick different environements on the fly.
Click ctrl + , then search for Conda Path and add absolute path to script, e.g.:
C:\Users\{myUser}\miniconda3\Scripts\conda.exe
Pick specific environment for each project in bottom left corner or through Command Pallete (ctrl + Shift + P -> search Python: Select Interpreter)
The simplest way to do it -
First open up terminal or command line and navigate to the project directory where you created the virtual environment.
Then activate the virtual environment with the command
conda activate venv_name
Once activated, in terminal type -
code .
This will open the vscode with the activated virtual environment. Look at the bottom of the pic. The dot after code . tells terminal to open the current directory in vscode.
I found out that if we do not specify which python version we want the environment which is created is completely empty. Thus, to resolve this issue what I did is that I gave the python version as well. i.e
conda create --name env_name python=3.6
so what it does now is that it installs python 3.6 and now we can select the interpreter. For that follow the below-mentioned steps:
Firstly, open the command palette using Ctrl + Shift + P
Secondly, Select Python: select Interpreter
Now, Select Enter interpreter path
We have to add the path where the env is, the default location will be
C:\Users\YourUserName\Anaconda3\envs\env_name
Finally, you have successfully activated your environment.
It might now be the best way but it worked for me. Let me know if there is any issue.
I found a hacky solution replace your environment variable for the original python file so instead it can just call from the python.exe from your anaconda folder, so when you reference python it will reference anaconda's python.
So your only python path in env var should be like:
"C:\Anaconda3\envs\py34\", or wherever the python executable lives
If you need more details I don't mind explaining. :)
As I was not able to solve my problem by suggested ways, I will share how I fixed it.
First of all, even if I was able to activate an environment, the corresponding environment folder was not present in C:\ProgramData\Anaconda3\envs directory.
So I created a new anaconda environment using Anaconda prompt,
a new folder named same as your given environment name will be created in the envs folder.
Next, I activated that environment in Anaconda prompt.
Installed python with conda install python command.
Then on anaconda navigator, selected the newly created environment in the 'Applications on' menu.
Launched vscode through Anaconda navigator.
Now as suggested by other answers, in vscode, opened command palette with Ctrl + Shift + P keyboard shortcut.
Searched and selected Python: Select Interpreter
If the interpreter with newly created environment isn't listed out there, select Enter Interpreter Path and choose the newly created python.exe which is located similar to C:\ProgramData\Anaconda3\envs\<your-new-env>\ .
So the total path will look like C:\ProgramData\Anaconda3\envs\<your-nev-env>\python.exe
Next time onwards the interpreter will be automatically listed among other interpreters.
Now you might see your selected conda environment at bottom left side in vscode.
"python.pythonPath" is deprecated, quote from vscode:
The "python.pythonPath" setting in your settings.json is no longer
used by the Python extension. If you want, you can use a new setting
called "python.defaultInterpreterPath" instead. Keep in mind that you
need to change the value of this setting manually as the Python
extension doesn’t modify it when you change interpreters. Learn more.
Thus, IF you want to assign the path manually (not reccommended, as explained above), open the "settings.json" of your workspace or the default one and use
{
"python.defaultInterpreterPath": "C:\\Users\\MYUSER\\anaconda3\\envs\\testenv\\python.exe"
}

How to run Conda?

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.
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 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 this video
https://youtu.be/Pr25JlaXhpc
It turns out that I had not set the path.
To do so, I first had to edit .bash_profile (I downloaded it to my local desktop to do that, I do not know how to text edit a file from linux)
Then add this to .bash_profile:
PATH=$PATH:$HOME/anaconda/bin
Use 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 (OS X < 10.15)
./anaconda3/bin/conda init
Mac OS X >= 10.15
./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.
Alternative shells
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.
Word of Caution
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.
Potential Automated Cleanup
Conda v4.6.9 introduced a --reverse flag that automates removing the changes that are inserted by conda init.
If you have installed Anaconda but 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.
This info is current as of today, August 10, 2016. 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 zsh, then after doing that, your terminal may show you zsh: command not found: rvm-prompt.
The solution is:
add alias rvm-prompt=$HOME/.rvm/bin/rvm-prompt within .zshrc file.
type source .zshrc.
Then the zsh: command not found: rvm-prompt will disappear.
My env: macOS & anaconda3
This works for me:
$ nano ~/.bash_profile
Add this:
export PATH=~/anaconda3/bin:$PATH
*The export path must match with the actual path of anaconda3 in the system.
Exit out and run:
$ source ~/.bash_profile
Then try:
$ jupyter notebook
Edit ~/.bash_profile, add this to it.
PATH=$PATH:$HOME/anaconda/bin
then run
source ~/.bash_profile
Hope can help you.
I'm on High Sierra MAC OS and just installed Anaconda3 via HomeBrew command. I had 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
it'll output:
$ conda --version
conda 4.4.10
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
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.
For Windows:
A recent Anaconda(version 4.4.0) changed some directories.
You can find "conda" in Anaconda3/Scripts, instead of Anaconda3/bin.
Mostly it is because when we install Anaconda in the end it adds the anaconda path to PATH variable in .bashrc file.
So we just need to restart the terminal or just do
source ~/.bashrc
if still it don't work then follow this commands.
cat >> ~/.bashrc
paste the below command for anaconda3
export PATH=~/anaconda3/bin:$PATH
hit Enter then ctrl+d
source ~/.bashrc
Using the export PATH= strategy with conda activate will result into a warning message for conda>=4.4.
The recommended way (see this release note, and this post) to do is to remove the export PATH=... line and add instead in your .bashrc (.bash_profile) the line:
. ~/anaconda2/etc/profile.d/conda.sh
Furthermore, if you want conda to be activated by default, add:
conda activate
If you have installed anaconda, but if you are not able to execute conda command from terminal, it means the path is not probably set, try :
export PATH=~/anaconda/bin:$PATH
See this link.
I also was facing the same issue ,this might be the simplest possible solution
source anaconda/bin/activate
for anaconda2 use
source anaconda2/bin/activate
depending on the name of the directory , then execute your command i.e. conda --create
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!
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.
Answer for
Anaconda3 5.2.0 installer
macOS HighSierra
ZSH
Unfortunately, the installer puts the PATH definition only into .bash_profile, but not the .zshrc config.
Contrary to the given answers, it doesn't (necessarily) install in ~/anaconda3/, but instead in /anaconda3/.
The PATHdefintion in .zshrc must therefore be this:
...
# Anaconda3
export PATH="/anaconda3/bin:$PATH"
...
Temporary solution:
$anaconda/bin/conda create -n py33 python=3.3 anaconda
If you have just installed MiniConda or Anaconda make sure you re-run your terminal.
From this, I mean close and open your terminal and then try conda list to verify your installation
For me, this worked!!
To edit bashrc in Ubuntu
$ /usr/bin/vim ~/.bashrc
type PATH=$PATH:$HOME/anaconda3/bin
Press Esc and :wq to save bashrc file and exit vim
enter image description here
then
$ export PATH=~/anaconda3/bin:$PATH
and type $ source ~/.bashrc
Now to confirm the installation of conda type
$ conda --version
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!!!
If you installed Anaconda with Visual Studio 2017 for Windows,
conda executable is in this path or similar.
In my case path is this:
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts
Steps to add it to your PATH:
On the Windows desktop, right-click My Computer.
In the pop-up menu, click Properties.
In the System Properties window, click the Advanced tab, and then click Environment Variables.
In the System Variables window, highlight Path, and click Edit.
Add your path and restart your cmd.
You will be able to execute conda
Happy coding!
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.
In my case conda Path was properly set (in .bashrc) by the conda installation bash. But to make it works I had to give executable file permissions to files in bin sub folder with chmod +x *.
My system info:
conda 4.2.9
Operating System: Debian GNU/Linux 8 (jessie)
Kernel: Linux 3.16.0-4-amd64
Architecture: x86-64
You need to put Anaconda.sh to your /home/, then run it to install. After that, you can runexport PATH=~/anaconda3/bin:$PATH . Remark: do not run Anaconda.sh in download/ directily!!!!!
I had same issue. What I did, removed anaconda directory from the install location and re-install
after that it worked as I anticipated
First, check the location of anaconda, for me I installed anaconda3 at / 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 intallation guide
1. Check where you have installed Anaconda. In my case it looks like /home/nour/anaconda3/bin
Open your .bashrc file. For example $ gedit .bashrc
3. 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 path in line no. 1 and line no. 3 must be same. In my case /home/nour/anaconda3/bin .
The main point is that as of December 2018 it's Scripts not bin.
Updating $PATH in "git bash for windows"
Use one of these:
export PATH=$USERPROFILE/AppData/Local/Continuum/anaconda2/Scripts/:$PATH
export PATH=$USERPROFILE/AppData/Local/Continuum/anaconda3/Scripts/:$PATH
Updating $PATH in the windows default command line
Use one of these:
SET PATH=%USERPROFILE%\AppData\Local\Continuum\anaconda2\Scripts\;%PATH%
SET PATH=%USERPROFILE%\AppData\Local\Continuum\anaconda3\Scripts\;%PATH%
Updating $PATH in Linux
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).
General Observations:
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.
Adding conda also enables ipython, which works much better in the native Windows command line
Following the strongly recommended installation does not add conda or ipython to the path
Anaconda 3 doesn't seem to install a command prompt application, but Anaconda 2 did have a command prompt application
The /bin folder seems to have been replaced with Scripts
Poking around in the Scripts folder is interesting, maybe the Anaconda command prompt application is in there somewhere.

Categories