How to Fix “Conda Command Not Found” Error?

Conda is a powerful open-source and cross-platform command-line package manager compatible with Windows, Linux, and Mac operating systems. It helps install packages, configure and update existing software packages, and install their associated dependencies on your systems. 

Conda is a command line tool that allows users to switch between different environments. So, with it, users can manage diverse project requirements efficiently. 

It was initially designed for Python programming, but now conda supports installing and managing software packages for any programming language. It emerges as a robust solution, streamlining package and environment management complexities for various applications and platforms.

Sometimes, while using this tool, an error may occur on the command line - “conda: command not found” or bash conda command not found. Most users don't even know why this error appears on their command prompt. 

So, in this guide, we will explore the potential causes of the conda command not found error. In addition, we will provide two different solutions to fix the conda: command not found error.


What Are the Reasons for the “Conda Command Not Found” Error?

Several reasons may trigger the "conda: command not found" error, and this section aims to explain the potential causes of this error. The primary and frequently encountered reason for such an error is the absence of the conda package. 

Namely, conda not working on your system may be a direct result of it not being installed on your system. Even if installed, the issue may persist if the conda is not added to the Environment variable Path or not properly set in the system, leading to the "bash conda command not found" error.


How to Fix Conda Command Not Found Error in Linux?

If you are using a Linux VPS server or Linux is installed on your system, you can remove the conda command not found error using the following guidelines:


Step-By-Step Guide: Fix “Conda: Conda Command Not Found” Error

You can fix the conda command not found error using two different solutions:


Solution 1: Install Anaconda 

The first solution to resolve the bash conda command not found error is to install conda on your system. Follow the steps outlined below:

Step 1: Update the Ubuntu Apt Repository

Update your system apt repository using the “apt update” command:

$ sudo apt update

Step 2: Download the Conda Installation Script

After updating all packages, start the Anaconda installation on your system. First, download the installation script for installing conda on the Ubuntu system using this command:

$ wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh

The above command downloads the conda installation script on your system’s home directory. 


how to fix “conda command not found” error?


Step 3: Execute Conda Installation Script

Once the script is downloaded, you can execute this installation script using the following command:

$ bash ~/Anaconda3-2022.05-Linux-x86_64.sh

Step 4: Add Conda to PATH Variable 

Once the installation is complete, configure the path for the Anaconda software. First, find the conda path and then execute the following command:

$ export PATH=/home/samreena/anaconda3/bin:$PATH

Make sure the path specified in this command matches the location where Anaconda was installed. Once the path is successfully added, the error should be resolved, and conda should function without any issues.


Solution 2: Adding Anaconda Installation to Environment Variable or PATH Variable

Updating the Path on Linux is an easy process. By executing the following two commands, the Anaconda path can be added to your system. The initial command updates the path within the bashrc file, while the subsequent source command ensures that this updated argument is applied to the file, as illustrated below:

$ echo 'export PATH=/path/to/anaconda3/bin:$PATH' >> ~/.bashrc

$ source .bashrc


How to Fix Conda Command Not Found Error in Windows?

Go to the Windows “Start” menu. Now, search for “Edit the system environment variables.” Next, click on “Environment Variables.”

Navigate to the “System Variables” section and select “Path.” Click on “Edit.” Add the Anaconda installation folder to the list of paths, which typically looks like “C:\Users\username\Anaconda3.”


Conclusion

In this guide, we demonstrated how to fix the conda command not found error on Ubuntu, as well as on Windows. We trust that the mentioned quick solution will assist you in resolving the "bash conda command not found" error. 

We explored ways to address this issue, such as adding conda to the path variable, initializing it, or running it with administrative privileges. The solutions provided in this article apply to VPS servers and across various major operating systems.