I attempted to downgrade my conda version. With conda at version 4.6.2, I ran conda install conda=4.5.12
. I then went to run other conda commands, but was met
The conda documentation explicitly mentions this issue in their "Troubleshooting" documentation
Conda upgrade error
Cause
Downgrading conda from 4.6.1 to 4.5.x and then trying to
conda install conda
orconda upgrade conda
will produce a solving and upgrade error similar to the following:Solving environment: failed CondaUpgradeError: This environment has previously been operated on by a conda version that's newer than the conda currently being used. A newer version of conda is required. target environment location: /opt/conda current conda version: 4.5.9 minimum conda version: 4.6
Solution
Change the .condarc file. Set the parameter by editing the .condarc file directly:
allow_conda_downgrades: true
in conda version 4.5.12. This will then let you upgrade. If you have something older than 4.5.12, install conda 4.6.1 again from the package cache.EXAMPLE: If my
conda info
sayspackage cache : /opt/conda/pkgs
and my Python version is 3.7, then on the command line, typeconda install /opt/conda/pkgs/conda-4.6.1-py37_0.tar.bz2
to resolve the issue.
This should already provide enough information to at least try to recover from that problem. I decided to add a few additional informations and to rephrase it in my own words:
Since you installed 4.5.12 you should be able to simply modify the .condarc
file and include (or change) allow_conda_downgrades: true
.
The documentation "Using the .condarc conda configuration file" provides the possible locations for the .condarc
file:
The
.condarc
file is not included by default, but it is automatically created in your home directory the first time you run theconda config
command.A
.condarc
file may also be located in the root environment, in which case it overrides any in the home directory.
Then update to 4.6 again (or whatever version you had previously):
conda install conda=4.6.2
Then change the setting in the .condarc
file back to false:
allow_conda_downgrades: false
The last step is optional but I think the default is false
to protect users from metadata-corruption by old conda versions. So I would change it back after recovering from the exception.
If that doesn't work or you had downgraded to an earlier version of conda
4.5.x then you have to use the other approach. Run:
conda info
Search for the line that starts with package cache :
. Navigate to that directory and look for conda....tar.gz.bz2
files. Select the one that you had previously installed and then run:
conda install PATH # <- replace the PATH with the actual path to the selected conda file
Note that you can also download the file from the anaconda channel directly and then provide the path to this downloaded file.
In case that did not work you could try brute-force approaches. Although be warned that they could do even more damage to your conda setup - treat them as last resort (e.g. when you consider uninstalling and reinstalling conda/anaconda).
For example you could also try to manually "install" it over the existing installation (again: this may not work and maybe you cannot undo this step again!):
I really struggled with this issue. All the solutions here did not work for me. This is what works for me:
/conda-meta/history
file in the root.conda update conda
.In Windows, if you have Anaconda Navigator installed, open it and update the conda version there from the GUI.
In Windows, I used Isaacsh's solution:
https://github.com/conda/conda/issues/1757
to create the .condarc file inside my c:\users\<username>
folder. I then added
allow_conda_downgrades: true
using Notebook
At the Anaconda Prompt, I entered conda install conda=4.6
and it installed version 4.6.3