189

I installed Anaconda 4.4.0 (Python 3.6 version) on Windows 10 by following the instructions here: https://www.continuum.io/downloads. However, when I open the Command prompt window and try to write

conda list

I get the

'conda' command is not recognized...

error.

I tried to run

set PATH=%PATH%;C:\Users\Alex\Anaconda3

but it didn't help. I also read that I might need to edit my .bashrc file, but I don't know how to access this file, and how I should edit it.

0xCursor
  • 2,242
  • 4
  • 15
  • 33
alex
  • 1,893
  • 2
  • 9
  • 6
  • In Windows 10, set path using [Environmental variable](https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10) – ramesh Jun 16 '17 at 20:45
  • @ramesh, thanks for your comment. In the link that you game, the following comment appears: " This method is only applicable to accounts from Administrators group. It is not possible to change environment variables of a regular User level account using this method". Unfortunately I am not in the Administrators group, so I cannot use this method. Is there some other way to do that? Thanks! – alex Jun 16 '17 at 20:50
  • Names of some programs seem to have changed in Anaconda 5.1. I was trying to set up Jupyter as an Anaconda novice and found that the instructions for 5.0 didn't work for 5.1. Rolled back to 5.0 and got things to work. Specifically, I couldn't locate conda and "jupyter notebook" seems to have changed to "jupyter-notebook." Not sure what else may have changed. – Eric J. Apr 05 '18 at 16:43
  • 2
    In Windows 10, I simply ran the following: `PATH=%PATH%;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Scripts` – bjd2385 Oct 16 '18 at 16:56
  • If you installed anaconda jsut for your user, in windows 10 anaconda is in C:\Users\%USERNAME%\AppData\Local\Continuum\anaconda3. I added both the root path and the root/Scripts/ folder to the PATH, works fine. – Eduardo Pignatelli Apr 04 '19 at 14:40
  • The Anaconda installer recommends against adding Anaconda to your path. When I did I couldn't get `conda` to work due to openssl not being found. Instead they recommend using Anaconda Prompt (see answer below). – Jimbo Jan 05 '20 at 20:02

14 Answers14

288

In Windows, you will have to set the path to the location where you installed Anaconda3 to.

For me, I installed anaconda3 into C:\Anaconda3. Therefore you need to add C:\Anaconda3 as well as C:\Anaconda3\Scripts\ to your path variable, e.g. set PATH=%PATH%;C:\Anaconda3;C:\Anaconda3\Scripts\.

You can do this via powershell (see above, https://msdn.microsoft.com/en-us/library/windows/desktop/bb776899(v=vs.85).aspx ), or hit the windows key → enter environment → choose from settingsedit environment variables for your account → select Path variable → EditNew.

To test it, open a new dos shell, and you should be able to use conda commands now. E.g., try conda --version.

Hans Ginzel
  • 8,192
  • 3
  • 24
  • 22
mjoppich
  • 3,207
  • 1
  • 11
  • 13
  • 4
    thanks for your reply. I added C:\Users\Alex\Anaconda3 to the path in System variables, but conda command is still not recognized. I also wrote "C:\Users\Alex>set PATH=%PATH%;C:\Users\Alex\Anaconda3" in my command prompt window, but it didn't work either. Am I doing something wrong? – alex Jun 16 '17 at 21:03
  • 2
    Sorry, did not notice there's also `C:\Anaconda3\Scripts\`in my Path ... In the Scripts subfolder you should also manually find a `conda.exe` . – mjoppich Jun 16 '17 at 21:17
  • 1
    Thanks. What should I do after I find it? add it to the path as well? – alex Jun 16 '17 at 21:19
  • Yup, add the folder to the path (sorry If I wasn't clear enough about that). – mjoppich Jun 16 '17 at 21:23
  • 3
    I installed Anaconda for all users on my Windows 10, so it ended up in path: C:\ProgramData\Anaconda3. I had to add the following in my path for conda to work: C:\ProgramData\Anaconda3\Scripts. – IvanD Sep 11 '17 at 23:34
  • @mjoppich but if the conda.exe does not get install for some reason? I do not have a conda.exe in my scripts folder. What to do? – Nima Mousavi Jan 16 '18 at 10:20
  • why does the latest installer say do NOT add conda to PATH? – john k Aug 22 '19 at 16:06
  • Because you are supposed to work in environments. These kind of have their own $PATH variable. Adding all the conda binaries to the global system may hide sytem binaries, etc. Nonetheless, advanced users may know what they are doing and still add it to their PATH. – mjoppich Aug 22 '19 at 18:55
  • 2
    Things have been changed after conda 4.6. See the answer by Simba below. – Rauni Lillemets Mar 30 '20 at 06:42
  • You might have to refresh the environment variables afterwards. run 'set PATH=C' , and then close and restart the command window – SumakuTension Oct 21 '21 at 07:41
  • You also need C:\Anaconda3\Library\bin. – quasipolynomial Feb 06 '22 at 12:14
  • For PowerShell I actually had to do this: $Env:PATH += ";C:\Users\bryanloz\Anaconda3\Scripts" – CraigDavid Aug 23 '22 at 23:20
  • This did not work for me. Try the answer from Simba in this thread. – quintengs Aug 29 '22 at 12:57
118

Things have been changed after conda 4.6.

Programs "Anaconda Prompt" and "Anaconda Powershell" expose the command conda for you automatically. Find them in your startup menu.

If you don't wanna use the prompts above and try to make conda available in a standard cmd.exe or a standard Powershell. Read the following content.


Expose conda in Every Shell

The purpose of the following content is to make command conda available both in cmd.exe and Powershell on Windows.

If you have already checked "Add Anaconda to my PATH environment variable" during Anaconda installation, skip step 1.

Anaconda installation options on Windows

  1. If Anaconda is installed for the current use only, add %USERPROFILE%\Anaconda3\condabin (I mean condabin, not Scripts) into the environment variable PATH (the user one). If Anaconda is installed for all users on your machine, add C:\ProgramData\Anaconda3\condabin into PATH.

    How do I set system environment variables on Windows?

  2. Open a new Powershell, run the following command once to initialize conda.

    conda init
    

These steps make sure the conda command is exposed into your cmd.exe and Powershell.


Extended Reading: conda init from Conda 4.6

Caveat: Add the new \path\to\anaconda3\condabin but not \path\to\anaconda3\Scripts into your PATH. This is a big change introduced in conda 4.6.

Activation script initialization fron conda 4.6 release log

Conda 4.6 adds extensive initialization support so that more shells than ever before can use the new conda activate command. For more information, read the output from conda init –help We’re especially excited about this new way of working, because removing the need to modify PATH makes Conda much less disruptive to other software on your system.

In the old days, \path\to\anaconda3\Scripts is the one to be put into your PATH. It exposes command conda and the default Python from "base" environment at the same time.

After conda 4.6, conda related commands are separated into condabin. This makes it possible to expose ONLY command conda without activating the Python from "base" environment.

References

Simba
  • 23,537
  • 7
  • 64
  • 76
  • 6
    Thanks, by far the best answer. I didn't want to add Python and everything else to my path, I wanted to follow best practices and use Virtual Environments which all the other answers mess up. – Rob Prouse Jan 19 '20 at 14:32
  • 6
    This is the correct answer in 2020 and by far the cleanest way to handle conda environments & paths. Also note, if you use git-bash(mingw), msys(2), or cygwin you have to run `\path\to\anaconda3\Scripts\conda.exe init bash` instead. – niid Feb 25 '20 at 09:12
  • To revert this, I presume I can reset PATH and call `conda init` again? – alexpghayes Aug 09 '20 at 23:29
  • 1
    Note that if you installed [Miniconda](https://docs.conda.io/en/latest/miniconda.html) instead of Anaconda, you'll need to add `%USERPROFILE%\miniconda3\condabin` to your `PATH`. – jdunning Apr 15 '22 at 06:55
  • 1
    Instead of "a new Powershell", I specifically had to run `conda init`in an "Anaconda Powershell Prompt". – Akaisteph7 Jun 29 '22 at 19:39
25

The newest version of the Anaconda installer for Windows will also install a windows launcher for "Anaconda Prompt" and "Anaconda Powershell Prompt". If you use one of those instead of the regular windows cmd shell, the conda command, python etc. should be available by default in this shell.

enter image description here

Håken Lid
  • 22,318
  • 9
  • 52
  • 67
24

When you install anaconda on windows now, it doesn't automatically add Python or Conda.

If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt

enter image description here

Next, you can add Python and Conda to your path by using the setx command in your command prompt. enter image description here

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

  • 1
    Hi, thanks. after install anaconda, "Close" the terminal (I use ubuntu bash in windows 10) and open a new one, which means restart the system in Ubuntu dose the trick! – zhihong Jan 08 '18 at 16:26
16

If you want to use Anaconda in regular cmd on windows you need to add several paths to your Path env variable.

Those paths are (instead of Anaconda3 the folder may be Anaconda2 depending on the Anaconda version on your PC):

\Users\YOUR_USER\Anaconda3
\Users\YOUR_USER\Anaconda3\Library\mingw-w64\bin
\Users\YOUR_USER\Anaconda3\Library\usr\bin
\Users\YOUR_USER\Anaconda3\Library\bin
\Users\YOUR_USER\Anaconda3\Scripts
\Users\YOUR_USER\Anaconda3\bin
Akaisteph7
  • 5,034
  • 2
  • 20
  • 43
Gabriel P.
  • 3,400
  • 2
  • 32
  • 23
3

I had also faced the same problem just an hour back. I was trying to install QuTip Quantum Toolbox in Python Unfortunately, I didn't stumble onto this page in time. Say you have downloaded Anaconda installer and run it until the end. Naively, I opened the command prompt in windows 10 and proceded to type the following commands as given in the qutip installation docs.

conda create -n qutip-env

conda config --append channels conda-forge

conda install qutip

But as soon as I typed the first line I got the following response

conda is not recognized as an internal or external command, operable program or batch file

error messsage

I went ahead and tried some other things as seen in this figures error message Finally after going through a number conda websites, I understood how one fixes this problem. Type Anaconda prompt in the search bar at the bottom like this (same place where you hail Cortana) Anaconda prompt

Once you are here all the conda commands will work as usual

Community
  • 1
  • 1
2

If you have installed Visual studio 2017 (profressional)

The install location:

C:\ProgramData\Anaconda3\Scripts

If you do not want the hassle of putting this in your path environment variable on windows and restarting you can run it by simply:

C:\>"C:\ProgramData\Anaconda3\Scripts\conda.exe" update qt pyqt
navarq
  • 1,075
  • 2
  • 15
  • 20
1

Even I got the same problem when I've first installed Anaconda. It said 'conda' command not found.

So I've just setup two values[added two new paths of Anaconda] system environment variables in the PATH variable which are: C:\Users\mshas\Anaconda2\ & C:\Users\mshas\Anaconda2\Scripts

Lot of people forgot to add the second variable which is "Scripts" just add that then conda command works.

Alen Paul Varghese
  • 1,278
  • 14
  • 27
1

You need to add the python.exe in C://.../Anaconda3 installation file as well as C://.../Anaconda3/Scripts to PATH.

First go to your installation directory, in my case it is installed in C://Users/user/Anaconda3 and shift+right click and press "Open command window here" or it might be "Open powershell here", if it is powershell, just write cmd and hit enter to run command window. Then run the following command setx PATH %cd%

Then go to C://Users/user/Anaconda3/Scripts and open the command window there as above, then run the same command "setx PATH %cd%"

user3578953
  • 146
  • 1
  • 2
1

To prevent having further issues with SSL you should add all those to Path :

 SETX PATH "%PATH%;C:\<path>\Anaconda3;C:\<path>\Anaconda3\Scripts;C:\<path>\Anaconda3\Library\bin"

Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website

deltascience
  • 3,321
  • 5
  • 42
  • 71
0

case #1 You should set 3 path:

%ANACONDAPATH%;
%ANACONDAPATH%\Scripts;
%ANACONDAPATH%\Library\bin;

It will solve problem:

C:\WINDOWS\system32>conda update conda
Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/msys2/noarch/repodata.json.bz2>
Elapsed: -
...

case #2 Also you can use Anaconda Promd (for Win10) instead CLI (cmd.exe)

0

According to the official documentation, for Windows users there are two environment variable PATHs which can be updated, depending on how your Miniconda/Anaconda distribution has been installed -- one is the SYSTEM PATH, the other is the USER PATH: https://docs.conda.io/projects/conda/en/master/user-guide/tasks/manage-environments.html#activating-an-environment

Basically it says the following: If like the official recommendation you have installed conda for yourself on the user level only, you can add a path similar to C:\Users\<user-name>\miniconda3\Scripts to the user variables.

Please remember to change to Anaconda if you are not using miniconda and update the to your system username in order for this to work.

However, if you have a system level install for all users on the same machine, you should add the path c:\miniconda3\Scripts\ to the system variables.

Also, please run conda init in your PowerShell to have conda working on your PowerShell. If there is a Python version already installed on your PC, you can disable "app execution aliases" in Settings (under "Manage app execution aliases") for this to use only the Python ones on the command line to avoid conflict.

Kris Stern
  • 1,192
  • 1
  • 15
  • 23
0

I just installed Python 3.11 and then tried to install Anaconda 23.5.2 in Windows 10, but there were conflicts when I tried to run the version commands.

So I fully removed both and just installed Anaconda. I opened a command prompt and python was showing up, but I had to add Anaconda to my environment variables as mjoppich explained both to Anaconda3 and also the scripts, as in:

C:\Users\myName\anaconda3\

C:\Users\myName\anaconda3\Scripts

Which worked. What was odd was I had installed both python and then conda without issue a few weeks ago with a slightly older version and had a path to python AND the path to Anaconda in my windows environment variables PATH.

I'm posting as these are the correct steps with the newest version to date.

James Drinkard
  • 15,342
  • 16
  • 114
  • 137
0

Just run the following command to set any path in Environment Variables in Windows 10:

This command will append the specified path to the PATH variable.

PATH=%PATH%;C:\your\path;C:\your\path\to\a\directory

The above command will add two paths in the PATH variable. that is: C:\your\path and C:\your\path\to\a\directory

Shubham Tomar
  • 166
  • 1
  • 9