Delete a Conda environment with a single command

To remove a Conda environment, open your terminal or command prompt and run conda remove --name environment_name --all, replacing environment_name with the actual name of the environment you want to delete. The --all flag removes the environment and all packages installed in it. Conda will ask you to confirm the deletion by typing y and pressing Enter.

If you do not remember the exact name of the environment, run conda env list first to see all environments on your system. The active environment has an asterisk next to it. Once you have confirmed the name, proceed with the removal command above.

Key Takeaways

  • The command conda remove --name environment_name --all deletes an environment and everything installed in it.
  • Use conda env list to see all your environments and their exact names before deleting.
  • You cannot delete the base environment, but you can delete any custom environment you created.
  • Deleting an environment frees up disk space and removes it from your system completely.

Find the exact name of the environment you want to remove

Before running the delete command, confirm the environment name by listing all environments. Open your terminal or command prompt and type conda env list. This displays every environment installed on your machine, with the active one marked by an asterisk.

Environment names appear in the left column. Copy the exact name — including any hyphens, underscores, or numbers — because the delete command is case-sensitive and will fail if you mistype it. If you have many environments, scroll through the list carefully or search for the one you want to remove.

Run the delete command in your terminal

Once you have the correct environment name, type the removal command: conda remove --name myenv --all, where myenv is replaced with your actual environment name. For example, if your environment is called data_analysis, the command is conda remove --name data_analysis --all.

Press Enter. Conda will display a list of packages it is about to remove and ask for confirmation. Review the list to make sure you are deleting the right environment, then type y and press Enter again. The deletion begins immediately and usually completes within seconds.

Alternative method: delete by file path

If the standard command does not work, you can remove an environment by its file path. First, find the path by running conda env list and looking at the full path shown for your environment. Then run conda remove --prefix /full/path/to/environment --all, replacing the path with the one from your list.

This method is useful if Conda has trouble recognizing the environment name or if the environment is stored in a non-standard location. The result is identical — the environment and all its contents are deleted.

Verify the environment is gone

After deletion completes, confirm the environment no longer exists by running conda env list again. The removed environment should not appear in the output. If it still shows up, the deletion may have encountered an error — try running the remove command again or check that you have write permissions in the directory where Conda stores environments.

Once the environment is gone from the list, it has been completely removed from your system. Any projects that relied on that environment will no longer be able to use it, so make sure you have switched to a different environment or created a new one before deleting.

What happens when you delete an environment

Deleting a Conda environment removes all packages installed in it and frees up the disk space those packages occupied. The environment folder itself is deleted from your Conda directory. Any scripts or notebooks that reference that environment will fail to run unless you update them to use a different environment.

The base environment — the default environment that comes with Conda — cannot be deleted. You can only remove custom environments you created. If you want to clean up your base environment, you can uninstall individual packages from it instead using conda remove --name base package_name.

Frequently Asked Questions

Can I recover an environment after I delete it?

No. Once you run the delete command and confirm it, the environment is permanently removed. If you need it again, you must recreate it and reinstall all packages. To avoid accidental deletion, double-check the environment name before running the command.

What if I get a permission denied error?

This usually means Conda does not have write access to the environment folder. On Windows, try running your terminal as administrator. On Mac or Linux, you may need to use sudo conda remove --name environment_name --all, though this is not recommended for user-level environments.

Can I delete the base environment?

No. Conda prevents deletion of the base environment because it contains core Conda tools. If you want to remove packages from base, uninstall them individually instead of deleting the entire environment.

How much disk space will I free up?

The amount depends on how many packages were installed and their size. Large environments with many packages can use several gigabytes. Run conda clean --all after deletion to remove unused package caches and free additional space.

Do I need to deactivate an environment before deleting it?

Yes. If the environment is currently active, deactivate it first by running conda deactivate. Then run the delete command. Conda will not let you delete an active environment.