I am using python v3.9 and anaconda on windows and I installed a bunch of packages in my base conda environment where now I am facing problems from there being conflicts between packages, not allowing me to install more packages that I require for my project. I am trying to reset my whole conda base environment and create new environments for my projects(which I should have done in the first place)
I know that there is a similar post already created : conda: remove all installed packages from base/root environment but I have tried them and I am still unsuccessful
I have tried reverting back my environment to original state before installing any additional packages but listing my revisions show that I am currently still in revision 0 so I am unable to do so.
I tried removing all installed packages from my environment using awk but I am unable to use awk as installing awk caused the same errors. I tried installing mamba which I have heard helps in resolving conflicts in packages but am again unable to install it due to the same conflicts.
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
I have also tried deleting everything and uninstalling before reinstalling anaconda but everytime I reinstalled it, it has the same base with all the packages inside.
How do I uninstall the packages in the base environment?
CodePudding user response:
$conda clean --all by using this command you can remove old packages. and then delete all environment and reset the
CodePudding user response:
You can't just 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.
Full Reversion(Not Recommended)
One way to do this is to revert your environment back to the original state before you installed any additional packages:
#Not generally recommended!
conda install --revision0
Be aware the multiple users have reported this breaking their Conda installation. I definitely would not run this on an installation that you have had for a long time or has many revisions.
Most importantly: Always review the proposed transactions in the base env! This is where Conda lives and unfortunately the safeguards against breaking an installation are not comprehensive.
If you really want a clean start, then export your envs to YAMLS and reinstallafresh Miniconda.
Partial Reversion
You can also look for other previous states that might be less of a regression, but still get rid of whatever packages you think you've unnecessarily accumulated.
conda list -n base -r
In the end, you'll probably want to upgrade conda right after, since it will also revert any updates to the base packages.
Errors,oh my!
While the above is the correct way to revert, I encounter the error:
Conda Revision Error: Cannot revert to 0, since :: contextlib2-0.5.3-py35_0 is not in repodata.
As an aside, this sort of worries me because it seems to indicate that the state of my Conda environment from two years ago is no longer reproducible from the state of the upstream channels.
Under this situation, I don't know a clean way to solve this other than comparing all the revision 0 packages to your current install and then uninstalling the difference. But again, a clean install of Miniconda seems like a nicer solution.
Generally,I've found that treating envs as immutable and installing as little as possible in base is the safest and most reliable way to use Conda.