How to reset anaconda root environment
Question:
How do I reset the root environment of anaconda? There has to be a simple conda reset command that does this.
I don’t want to reinstall anaconda all over again. I have other virtualenvs that I don’t want to overwrite and that will happen if I install anaconda again.
Answers:
See https://github.com/conda/conda/issues/1032
This has been implemented as conda list --revisions
and conda install --rev REV_NUM
.
EDIT: be careful though if you execute conda install --rev 0
as this will remove your root environment and the conda
command. Maybe conda install --rev 1
would produce the desired behavior (restore root environment to its state after first installation).
EDIT 2018-03-07: Use the --revision
argument instead of --rev
One might also consider conda update anaconda
as a "nuclear option". The anaconda
meta-package links together certain versions of packages that Continuum Analytics has figured out all play nice together.
Edit: As @mforbes points out, only do this if you are wanting to reset the base anaconda environment as distributed with the Anaconda (not Miniconda) installer. It has about 550 packages and is about a 1G download.
While this is not exactly what you are asking, I found conda clean --all
useful to clean out a bunch of old packages, logs etc. which somewhat restores conda
to a new state.
This might be overkill but this worked for me when nothing else would. This is what is referred to as "nuking" in the above posts
Revert anaconda back to the install state
conda install –rev 1
Uninstall all pip files
pip uninstall -y -r <(pip freeze)
remove all anaconda files
rm -rf /Users/[username]/opt/anaconda3
reinstall from https://www.anaconda.com/products/distribution
Update anaconda
conda update conda
NOTE: Close your terminal between each step if you want to make sure you don’t get "directory not found" errors
This worked for me:
conda update --all
conda update -n base -c defaults conda
How do I reset the root environment of anaconda? There has to be a simple conda reset command that does this.
I don’t want to reinstall anaconda all over again. I have other virtualenvs that I don’t want to overwrite and that will happen if I install anaconda again.
See https://github.com/conda/conda/issues/1032
This has been implemented as
conda list --revisions
andconda install --rev REV_NUM
.
EDIT: be careful though if you execute conda install --rev 0
as this will remove your root environment and the conda
command. Maybe conda install --rev 1
would produce the desired behavior (restore root environment to its state after first installation).
EDIT 2018-03-07: Use the --revision
argument instead of --rev
One might also consider conda update anaconda
as a "nuclear option". The anaconda
meta-package links together certain versions of packages that Continuum Analytics has figured out all play nice together.
Edit: As @mforbes points out, only do this if you are wanting to reset the base anaconda environment as distributed with the Anaconda (not Miniconda) installer. It has about 550 packages and is about a 1G download.
While this is not exactly what you are asking, I found conda clean --all
useful to clean out a bunch of old packages, logs etc. which somewhat restores conda
to a new state.
This might be overkill but this worked for me when nothing else would. This is what is referred to as "nuking" in the above posts
Revert anaconda back to the install state
conda install –rev 1
Uninstall all pip files
pip uninstall -y -r <(pip freeze)
remove all anaconda files
rm -rf /Users/[username]/opt/anaconda3
reinstall from https://www.anaconda.com/products/distribution
Update anaconda
conda update conda
NOTE: Close your terminal between each step if you want to make sure you don’t get "directory not found" errors
This worked for me:
conda update --all
conda update -n base -c defaults conda