Open In App
Related Articles

How to Delete an Environment in Conda

Like Article
Save Article
Report issue

If you have an environment in Anaconda and you no longer need it in your Anaconda, in this article we will see how to deactivate an environment in Anaconda and delete it. Firstly, let’s know what is an anaconda environment.

Anaconda Environment

Anaconda environments commonly known as Environment in Conda is generally the directory that contains the installed packages as per our choice. The environment is mostly helpful in cases when the packages needed for one project differ from another.

Why do we use the Environment in Conda

When we first install the anaconda into our system, the basic environment is installed, which is called the ‘base‘. As we use it more and more for complex projects, we would find the need to update the packages again and again. This might make it difficult to work when working on different projects which require different packages and dependencies. This is because there are possibilities that the packages and the dependencies conflict with each other. Hence, environments are very helpful to developers.

If you want to know how to create an environment in Anaconda, please refer- Set up a virtual environment in Anaconda

Reasons to Delete Conda Environment

As there are many benefits, there are also some cases where there would be a need to delete them. Some of the reasons are:

  • Unused Environments: After we create environments for certain projects and complete work on them, we might not need them anymore. In those cases, we might need to delete the unused environments.
  • Cleaning Up: This is the reason to maintain the tidiness of your workspace. If this is done regularly, it can be really helpful in having an organized development process.
  • Dependency Management: Sometimes, the environments face conflicts with other environments if they share few dependencies. If we delete the unused environment, it would help in reducing these conflicts.

Removing Conda Environment

For performing all these steps, you need to already have Anaconda installed in your computer, and even have an environment other than the default environment (base). We are going to perfom these steps using the ‘Anaconda Prompt‘. The steps are:

Step 1: Open Anaconda Prompt

Go to search box in your system and type ‘Anaconda Prompt‘, which is already on your system and open it.


search for anaconda prompt

Step 2: List the Environments Installed

After opening the prompt, type the following command. This displays the list of all the environments present in your anaconda along with their directories. Now, we can check for the environment we want to delete.

conda env list

list of environments command

Step 3: Deactivate the Environment

Here, we need to first deactivate the environment before deleting it. This is important so that the environment in not currently in use. In simple words, it is like coming out of the environment and going to the base. The command is:

conda deactivate

conda deactivate command

We can observe in the picture, how we came to base environment from gfg environment.

Step 4: Delete the Conda Environment

Now, just need to delete the environment by giving its name using the following command.

conda env remove --name environment_name

In the above command, –name is a flag which we are using to indicate that we are giving the name of the environment we wanted to remove. This command will also display the packages deleted in the environment if any.


delete env command

Step 5: Verification

This is the final step to verify if the environment is deleted. We can use the list command again.

conda env list

final verification

Now, you have successfully deleted your anaconda environment.

Last Updated : 16 Oct, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads