Delete a Conda environment by running a single command in your terminal
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 before deleting — type y and press Enter to proceed.
If you do not remember the exact name of your environment, run conda env list first to see all environments on your system. The active environment has an asterisk next to it. Once you identify the one to delete, use the command above with its correct name.
The deletion is permanent — Conda removes the folder and all files associated with that environment. You cannot undo this action, so make sure you are deleting the right one before confirming.
Key Takeaways
- Run conda remove --name environment_name --all in your terminal to delete an environment and all its packages at once.
- Use conda env list to see all your environments and find the exact name of the one you want to remove.
- Deactivate the environment before deleting it by running conda deactivate — you cannot delete an active environment.
- Deleting an environment does not affect other environments or your base Conda installation.
- The deletion is permanent and cannot be reversed, so confirm you have the correct environment name before proceeding.
Why you might delete an environment
Conda environments let you keep different sets of packages isolated from each other — one project might need Python 3.8 with specific libraries, while another needs Python 3.11 with different ones. Over time, you accumulate environments you no longer use, and they take up disk space.
Deleting unused environments frees up storage and keeps your system cleaner. It also reduces clutter when you run conda env list and makes it easier to find the environments that actually matter for your current work.
Deactivate the environment first
If the environment you want to delete is currently active (you can see its name in parentheses at the start of your terminal prompt), you must deactivate it before Conda will let you remove it. Run conda deactivate to switch back to your base environment.
After deactivating, your prompt should show (base) instead of the environment name. Now you can safely run the delete command. Conda prevents you from deleting an active environment because packages in that environment might be in use.
Delete by environment path instead of name
If you created an environment in a custom location (not Conda's default folder), you can delete it using the path instead of the name. Run conda remove --prefix /path/to/environment --all, replacing /path/to/environment with the actual folder path.
You can find the path of any environment by running conda env list — it shows the folder location next to each environment name. Use this method only if the environment is in a non-standard location; for most environments, using the name is simpler.
Remove packages without deleting the entire environment
If you want to keep an environment but remove only certain packages from it, use conda remove --name environment_name package_name instead. This deletes just that package while leaving the environment and other packages intact.
For example, conda remove --name myproject numpy removes NumPy from the myproject environment but keeps the environment itself and any other packages you installed. This is useful when you need to clean up without starting over.
Check disk space freed after deletion
Deleting an environment usually frees up several hundred megabytes to a few gigabytes, depending on how many packages you installed. If you want to see how much space Conda is using overall, run conda clean --all — this removes unused package caches and can free up additional space without touching your environments.
The --all flag in the clean command is different from the one in the remove command. The clean command removes cached package files that Conda downloaded but no longer needs, while the remove command deletes the environment itself.
Frequently Asked Questions
Can I recover an environment after I delete it?
No, deletion is permanent. Conda removes the entire folder and all files. If you had the environment backed up or can recreate it from a requirements file, you can rebuild it, but the original environment cannot be restored.
What happens if I delete the base environment?
Do not delete the base environment — it is the default environment Conda uses and is required for Conda itself to work. Deleting it can break your Conda installation. If you accidentally delete it, you may need to reinstall Conda.
Can I delete multiple environments at once?
You can run the delete command multiple times for different environments, but Conda does not have a built-in command to delete several at once. Run conda remove --name env1 --all, then conda remove --name env2 --all, and so on for each one you want to remove.
Does deleting an environment affect my Python installation?
No, deleting a Conda environment only removes that isolated environment and its packages. Your system Python and other environments remain untouched. Each environment is completely separate from the others.
How do I know how much space an environment uses?
You can check the folder size of an environment by navigating to its location (shown in conda env list) and checking the folder properties in your file manager, or by running du -sh /path/to/environment in your terminal on macOS or Linux.