I want to remove a certain environment created with conda. How can I achieve that? Let's say I have an active testenv environment. I tried, by following documentation, with:
$ conda env remove CondaEnvironmentError: cannot remove current environment. deactivate and run conda remove again
I then deactivate it:
$ source deactivate
I try running again the command to remove it and I still get the same error. What is going wrong here?
It's not that, but instead that you can't remove the base environment, which is what the --all flag does. You can't uninstall all packages in base because that's where the conda executable lives. Instead, what you want to do is uninstall all user-installed packages.
Delete Environment Variables You need to just use the unset command with the variable name to delete it. This command will remove the variable permanently.
You probably didn't fully deactivate the Conda environment - remember, the command you need to use with Conda is conda deactivate
(for older versions, use source deactivate
). So it may be wise to start a new shell and activate the environment in that before you try. Then deactivate it.
You can use the command
conda env remove -n ENV_NAME
to remove the environment with that name. (--name
is equivalent to -n
)
Note that you can also place environments anywhere you want using -p /path/to/env
instead of -n ENV_NAME
when both creating and deleting environments, if you choose. They don't have to live in your conda installation.
UPDATE, 30 Jan 2019: From Conda 4.6 onwards the conda activate
command becomes the new official way to activate an environment across all platforms. The changes are described in this Anaconda blog post
After making sure your environment is not active, type:
$ conda env remove --name ENVIRONMENT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With