ChatGPT解决这个技术问题 Extra ChatGPT

How do I revert to a previous package in Anaconda?

If I do

conda info pandas

I can see all of the packages available.

I updated my pandas to the latest this morning, but I need to revert to a prior version now. I tried

conda update pandas 0.13.1

but that didn't work. How do I specify which version to use?


c
chrisaycock

I had to use the install function instead:

conda install pandas=0.13.1

Seems this is not working when you have already installed package, so it's not downgrading, it's just fresh install of specific version. So you need to uninstall old version and install new specific version.
@mrgloom conda remove also updates some packages I don't want to be updated.
@mrgloom plain install pkg=1.2.3 works for me in 2022 for downgrading: gist.github.com/maphew/273b5c5af1c11664724ecdeafd52ddca. It did take a long time for the "Solving environment" stage though.
a
anon01

For the case that you wish to revert a recently installed package that made several changes to dependencies (such as tensorflow), you can "roll back" to an earlier installation state via the following method:

conda list --revisions
conda install --revision [revision number]

The first command shows previous installation revisions (with dependencies) and the second reverts to whichever revision number you specify.

Note that if you wish to (re)install a later revision, you may have to sequentially reinstall all intermediate versions. If you had been at revision 23, reinstalled revision 20 and wish to return, you may have to run each:

conda install --revision 21
conda install --revision 22
conda install --revision 23

This should be the correct answer as it should roll back updated dependencies as well
Note that this solution can currently lead to conda itself being removed. I ended up having to reinstall anaconda from scratch after trying this. Seems to be an open issue
This is buggy. Doesn't work. I lost my packages including numpy.
This worked for me. My problem occurred when i installed tensorflow which made loads of changes to my environment. Next time, as a best practice, i advice people(myself included) to create a new environment for any new package that wants to make changes to existing ones so concerns are separated.
@FridolinLinder now the open issue has been closed
S
Szèles Àron

I know it was not available at the time, but now you could also use Anaconda navigator to install a specific version of packages in the environments tab.


Lol, if navigator isn't broken. There are some instructions on the anaconda website that only tell you how to do something in Navigator. But mine never opens, so... And I haven't been able to fix it. In fact I've done conda updates and navigator updates, and wound up breaking Jupyter Notebook AND updates in the process :-/ Anyway, I chuckle only because of this. It is probably a great tip!
I do agree it is not always reliable but I have had times when doing it this way turned out to be easier.