Delete Conda Environment (7 commands) (2024)

Delete Conda Environment (7 commands) (1)

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

In this article, we have explained and presented 7 commands to delete a Conda environment permanently. We can delete a conda environment either by name or by path.

Table of contents:

  1. Step 1: Find the Conda environment to delete
  2. Step 2: Get out of the environment
  3. Step 3: Delete the Conda Environment (6 commands)
  4. Delete Directory directly?
  5. Why to delete a Conda environment?

Step 1: Find the Conda environment to delete

To find the name of the environment you want to delete, we can get the list of all Conda environments as follows:

conda env list

Let the name of the environment to be delete is corrupted_env.

Step 2: Get out of the environment

You cannot delete the conda environment you are within. To get out of the current environment, use the command:

conda deactivate

Step 3: Delete the Conda Environment (6 commands)

If the name of the environment to be delete is corrupted_env, then use the following command to delete it:

conda env remove -n corrupted_env

OR

conda env remove --name corrupted_env

Alternatively, we can use the following command:

conda remove --name corrupted_env --all

OR

conda remove -n corrupted_env --all

If you have the path where a conda environment is located, you can directly specify the path instead of name of the conda environment. In this case, the command will be:

conda env remove -p /path/to/env

OR

conda env remove --prefix /path/to/env

Delete Directory directly?

It is not advised to delete the directory directly where the conda environment is stored. In some cases, it might be necessary so the steps are:

  • Find the path of the conda environment using:
conda info --envs
  • Delete the directory directly:
rm -rf /Users/username/.local/share/conda/envs/corrupted_env

Why to delete a Conda environment?

You may need to delete a conda environment for the following reasons:

  • To free space: Conda environments consume space and you may eventually, run out of space on your system. To free space, you can delete conda environments you do not want.
  • Delete a corrupted environment: Conda environments get corrupted easily and it is often, easier to start from scratch by creating a new environment. In this case, you will want to delete the corrupted conda environment to stay safe.
  • Good practice: It is a good practice to delete the conda environments you do not need.

With this article at OpenGenus, you must have the complete idea of how to delete a conda environment.

Delete Conda Environment (7 commands) (2024)
Top Articles
Latest Posts
Article information

Author: Wyatt Volkman LLD

Last Updated:

Views: 5865

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Wyatt Volkman LLD

Birthday: 1992-02-16

Address: Suite 851 78549 Lubowitz Well, Wardside, TX 98080-8615

Phone: +67618977178100

Job: Manufacturing Director

Hobby: Running, Mountaineering, Inline skating, Writing, Baton twirling, Computer programming, Stone skipping

Introduction: My name is Wyatt Volkman LLD, I am a handsome, rich, comfortable, lively, zealous, graceful, gifted person who loves writing and wants to share my knowledge and understanding with you.