Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conda install screwed up my environment. Can I undo it?

I tried installing rpy2 so that I could work with R files (.rda) using conda install -c r rpy2, and it totally screwed up my environment.

For example:

1) When I try importing pandas, I get this error: AttributeError: module 'pandas' has no attribute 'core'

2) When I try importing matplotlib, I get this error: AttributeError: module 'matplotlib' has no attribute 'artist'

I wasn't having these issues before I installed this package. Is there a way to undo what I just did - as if I never installed it in the first place?

like image 318
Austin Avatar asked Jan 13 '19 19:01

Austin


People also ask

How do you undo a conda install?

If you want to revert to a previous revision you can simply run conda install --revision N (where N is the revision number). This will ask you to confirm the relevant package uninstallation/installation – and get you back to exactly where you were before!

How do you fix a broken conda environment?

The fix is to use the ./bin/conda executable in the conda git repository to force reinstall conda. That is, run ./bin/conda install -f conda . You can then verify with conda info that you have the latest version of conda, and not a git checkout.

How do I delete an existing conda environment?

Remove your environment You can use conda env remove to remove the environment. Same thing as create, you have to specify the name of the environment you wish to remove by using --name .

How do you get back to base environment in Anaconda?

If you want to switch to another environment you could simply type: conda activate myenv within the base environment. Now when you deactivate myenv it will go back to base environment. When you are within an environment, the packages within that environment can be accessible.


1 Answers

You can "roll back" to a previous revision. First, run:

conda list --revisions

You will get a list of revisions with their revision number. Then, look at the second-to-last revision and take note of its number. To revert to this revision, run:

conda install --revision N

where N is the revision number.

like image 161
iz_ Avatar answered Oct 21 '22 22:10

iz_