How to Fix 'conda is not recognized' Error: Working with Anaconda 2018.12 in Visual Studio Code
If you’ve recently installed Anaconda 2018.12 and tried using conda commands in Visual Studio Code (VS Code)’s integrated terminal, you may have encountered the frustrating error: 'conda' is not recognized as an internal or external command, operable program or batch file. This error typically arises because your system’s environment variables (specifically the PATH variable) do not include the directory where Anaconda’s conda executable is stored.
Anaconda 2018.12, like many older versions, does not automatically add itself to the system PATH during installation (by default), which can lead to this issue. This guide will walk you through step-by-step solutions to resolve the error, ensuring conda works seamlessly in VS Code. We’ll cover manual PATH configuration, verifying installations, and troubleshooting common pitfalls.
Understanding the 'conda is not recognized' Error#
The conda command is part of Anaconda’s package management toolkit. When your terminal (including VS Code’s integrated terminal) throws "‘conda’ is not recognized," it means the system cannot locate the conda executable. This happens when:
Anaconda was not added to the system PATH during installation (default behavior for Anaconda 2018.12).
The PATH variable was modified or corrupted after installation.
VS Code is using a different shell environment that doesn’t inherit the updated PATH.
First, confirm Anaconda is installed correctly. Anaconda includes a dedicated "Anaconda Prompt" that should recognize conda even if the system PATH is not updated.
Edit Your Shell Configuration File:
macOS/Linux use shell profiles like .bashrc, .bash_profile, or .zshrc (depending on your shell). To find your shell, run echo $SHELL (e.g., /bin/bash or /bin/zsh).
For bash: Open ~/.bashrc or ~/.bash_profile with a text editor (e.g., nano ~/.bashrc).
For zsh: Open ~/.zshrc (e.g., nano ~/.zshrc).
Add Anaconda to PATH:
Add this line at the end of the file (replace /path/to/anaconda3 with your actual path, e.g., ~/anaconda3):
export PATH="/path/to/anaconda3/bin:$PATH"
Save and Apply Changes:
Press Ctrl + O to save, Ctrl + X to exit nano.
Run source ~/.bashrc (or source ~/.zshrc, etc.) to apply the changes immediately.
Run conda info to confirm conda can access your environment. You should see details like your Anaconda install path and default environment.
Alternative: Reinstall Anaconda with PATH Enabled#
If manual PATH editing feels intimidating, reinstall Anaconda 2018.12 and check the "Add Anaconda to my PATH environment variable" option during setup.
Anaconda 2018.12 shows a warning about potential conflicts with other software when adding to PATH. This is safe for most users, but avoid if you have multiple Python versions installed (e.g., Python from Microsoft Store).
The "‘conda is not recognized’" error is a common hiccup with Anaconda 2018.12, but it’s easily fixed by adding Anaconda’s directories to your system PATH. By following the steps above—verifying the installation, locating the Anaconda directory, updating PATH, and restarting VS Code—you’ll have conda working in no time.
If you still face issues, refer to the troubleshooting section or Anaconda’s official documentation for further help.