Consider switching to using YAMLs to manage your envs and refrain from using conda update/install/remove
commands. When you want to make multiple changes to an env, change them in the YAML, then use:
conda env update -f environment.yaml
This command also has the optional argument --prune
which will remove any packages that are not required, i.e., provides the package deletion mechanism you seek.
Note that conda env
commands do not provide a transaction review step. For that reason, I would not recommend using it to manage the base env.
Starting from Existing Env
To get a working YAML from an existing env (say foo), try running something like
conda env export -n foo --from-history > foo.yaml
The --from-history
argument will only include the explicit specs that you've provided to the env, so the YAML will look closer to what one might make and maintain from scratch.
Note that if there were packages installed through pip
they won't appear in the --from-history
version. In that case, I would still begin from this version, then export a full YAML to capture any pip
specs, and add them to the simpler version.