'conda' is not recognized as an internal or external command

avatar
Borislav Hadzhiev

Last updated: Apr 4, 2024
5 min

banner

# 'conda' is not recognized as an internal or external command

The error "'conda' is not recognized as an internal or external command, operable program or batch file" occurs for 2 main reasons:

  1. Not having the path to Anaconda added to your user's PATH environment variable.
  2. Not having Anaconda installed on your machine.

conda is not recognized as internal or external command

If you don't have Anaconda installed, scroll down to the next subheading.

To solve the error if you have Anaconda installed:

  1. Type Anaconda Prompt in the Search bar and start the app.

search anaconda prompt

  1. Type where conda to get the location of your Anaconda installation.
anaconda-prompt
where conda

where conda output

For example, in my case, Anaconda is installed under the following path.

anaconda-prompt
C:\Users\YOUR_USER\anaconda3

This means that I have to add the following 3 paths to my user's PATH environment variable.

anaconda-prompt
C:\Users\YOUR_USER\anaconda3 C:\Users\YOUR_USER\anaconda3\Scripts C:\Users\YOUR_USER\anaconda3\Library\bin
  1. Click on the Search bar and type "environment variables".
  2. Click on "Edit the system environment variables".

edit system environment variables

  1. Click on the "Environment Variables" button.

click environment variables

  1. In the "User variables for YOUR_USER" section, select the "Path" variable and click "Edit".

select user path click edit

  1. You can either click "New" and then "Browse" and navigate to the paths you got from the where conda command to add them or simply click "New" and add the paths directly.

click new to add paths

For me, the paths look as follows.

anaconda-prompt
C:\Users\YOUR_USER\anaconda3 C:\Users\YOUR_USER\anaconda3\Scripts C:\Users\YOUR_USER\anaconda3\Library\bin

Make sure to replace the YOUR_USER placeholder with your actual username if your Anaconda installation location is C:\Users\YOUR_USER\anaconda3, otherwise, issue the where conda command in Anaconda Prompt.

Here is what it looks like for me after I've added the 3 paths.

added anaconda paths

  1. Once the three paths are added, confirm the changes by clicking on the "OK" button twice.

  2. Close your Command prompt application and then reopen it.

Note that you must restart your Command prompt shell for the changes to take effect.

You might also have to restart your PC, but that's not always necessary.

Open a new Command Prompt and run the conda --version command to make sure everything works as expected.

cmd
conda --version conda install anaconda-navigator

If you get a permissions error when running a conda command, you have to open CMD as an administrator and rerun the command.

To open CMD as an administrator:

  1. Click on the Search bar and type CMD.

  2. Right-click on the Command Prompt application and click "Run as administrator".

windows run cmd as administrator

Note that you can use the Anaconda Prompt, in which the conda command will always be available or the Anaconda Navigator.

You can find either application using the Search bar.

If the error persists, download the official installer.

# Using the official installer to install and configure Anaconda

If you have Anaconda installed, you have to uninstall it before starting the installer.

  1. Type Anaconda Prompt in the Search bar and start the app.

search anaconda prompt

  1. Use the where conda command to get the location where Anaconda is installed.
anaconda-prompt
where conda

where conda output

For me, it is C:\Users\YOUR_USER\anaconda3.

  1. Open the directory in Explorer and look for a file named "Uninstall-Anaconda3.exe".

uninstall anaconda exe

  1. Click twice on the "Uninstall-Anaconda3.exe" file and complete the process.

reboot to finish uninstall

  1. You will have to reboot your PC at the last step of the process.

run uninstaller

To solve the error "'conda' is not recognized as an internal or external command, operable program or batch file":

  1. Download the Anaconda installer.

download anaconda installer

  1. Start the installer and click "Next".

start anaconda installer

  1. Install for your user only or for all users (requires admin privileges).

anaconda install for

  1. Leave the default destination folder selected and click "Next".

anaconda select destination folder

Note: if you had Anaconda previously installed, you might have to delete the C:\Users\YOUR_USER\anaconda3 directory if it isn't empty.
  1. In the "Advanced Options" section, make sure to tick the "Add Anaconda3 to my PATH environment variable" checkbox.

add anaconda path to env variable

  1. Once the "Add Anaconda3 to my PATH environment variable" option is checked, click on "Install".

  2. Lastly, click on "Finish".

finish anaconda installation

Once the installation process completes, you have to restart any active Command Prompt or PowerShell sessions.

Open CMD and try to run the following commands to verify that the conda command is available.

cmd
conda --version conda install anaconda-navigator

If you get a permissions error when running a conda command, you have to open CMD as an administrator and rerun the command.

To open CMD as an administrator:

  1. Click on the Search bar and type CMD.

  2. Right-click on the Command Prompt application and click "Run as administrator".

run cmd as administrator

Note that you can also use the Anaconda Prompt, in which the conda command will always be available or the Anaconda Navigator.

You can find either application using the Search bar.

# Conclusion

To solve the error "'conda' is not recognized as an internal or external command, operable program or batch file", make sure:

  1. You have the path to Anaconda in your user's PATH environment variable.
  2. You have Anaconda installed on your machine.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.