In this article, We will analyze the common issues that can cause the “Conda Command not Found” ERROR and How to Fix the Error.
As a whole “conda command not found” statement indicates that the conda command-line tool is not installed on your system or the executable is not in your system’s PATH environment variable and it is applicable for all the Operating system types
Let’s learn more in-depth about the solutions to help you resolve it and get back to working on your project. First, let’s see what is conda?
What is Conda?
Conda is a package and environment management system used in Python. It is used to manage dependencies and packages required for a particular project, making it easier to manage and share the software and its dependencies.
With Conda, you can create isolated environments for different projects and easily switch between them. This helps to avoid conflicts between packages and their dependencies, making it a popular choice for data science and scientific computing projects.
Conda is also a platform-agnostic tool, which means it can be used on Windows, macOS, and Linux. This makes it a versatile and flexible tool for managing Python packages and environments.
FIX Conda Command not Found error in Windows OS
The conda command not found error message appears when the conda executable is not in your system’s PATH environment variable. To resolve this issue, you can do the following steps:
The first step in troubleshooting Conda is to make sure that it is installed correctly. Conda might not work properly if the installation process was not completed successfully. To check this, you can do the following steps:
- Open the Command Prompt or Anaconda Prompt (if Anaconda is installed).
- Type the following command followed by the Enter key:
If the above command did not produce any output, it means that conda is not installed on your system. To ensure a successful installation, follow the instructions provided by the Anaconda website.
Add Conda to PATH
If the output given by the where conda command in the above step shows the path of the conda executables on the System, add it to your PATH environment variable using the below command and press Enter:
setx PATH "%PATH%;<conda-executable-path>"
Replace <conda-executable-path> with the actual path of the conda executable which you obtained in the above step.
Restart Terminal or Command Prompt
Close and reopen the terminal or command prompt to ensure the changes to the PATH environment variable take effect.
To verify that Conda is working, run the following command in the command prompt.
If you have multiple versions of conda installed, make sure you are using the correct version by using the correct installation path.
Run the following command to initialize conda in windows:
$ ./anaconda3/Scripts/conda.exe init
If the error persists, try uninstalling and reinstalling Conda following the instructions provided by the Anaconda website.
FIX Conda Command not Found error in Linux OS
To resolve the conda command not found error on a Linux system, you can do the following steps:
Open the terminal and type the following command:
If the above command did not produce any output, it means that conda is not installed on your system. In that case, you can download and install the Anaconda distribution, which comes with conda pre-installed. The installation instructions and download links can be found on the official Anaconda website.
Add Conda to PATH
If the above output shows the path of the conda executable, you can add it to your PATH environment variable by running the following command:
Note: Replace <conda-executable-path> with the actual path of the conda executable.
Now, verify that the conda command is now in your PATH:
You should see the path to the conda executable.
Reload Shell Profile
Start a new terminal session or reload your shell profile to make sure that the change to your PATH is picked up. Source your shell profile file using the following command:
Note: Replace <shell-profile-file> with the actual name of your shell profile file.
Let’s assume you are using a bashrc file. It will be like source ~/.bashrc and if you have a different shell, replace ~/.bashrc with the appropriate file for your shell, such as ~/.bash_profile or ~/.zshrc.
Try running the conda command to verify conda is available.
Now you should be able to use the conda command without encountering the conda command not found error.
To initialize conda in the Linux operating system, run the following command:
$ ./anaconda3/bin/conda init
In this article, we have covered the steps to resolve the conda command not found error in both Windows and Linux operating systems. You can effectively troubleshoot and solve this issue by verifying the installation, checking the location, adding the conda executable to the PATH, and initializing the conda.
Good Luck with your Learning !!