I was trying to fix an issue with an old environment earlier today and screwed up conda
. I get this:
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: /Users/U6020643/anaconda3
current conda version: 4.5.11
minimum conda version: 4.8
The original problem: I recently upgraded to Catalina, and could not build Pandas when installing it to recreate an environment.
Rehoming: Was this post regarding How to Restore Anaconda after Update to MacOS Catalina . I downloaded the script and ran it. It appeared to work. But I had the same problem with Pandas.
./cpr rehome ~/anaconda3
Installing a revision : At some point in my debugging I also ran this, which I have a hunch caused the problem.
conda install --revision 0
Trying to install Conda 4.8 : I found this post and attempted the accepted solution.
I added allow_conda_downgrades: true
to my ~/.condarc
file. conda update conda
produced the same CondaUpgradeError
and so did conda install conda==4.8.1
.
Next I found the package-cache via conda info
and attempted to install 4.8 from there. Here is my conda info
output.
active environment : None
user config file : /Users/me/.condarc
populated config files : /Users/me/.condarc
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : /Users/me/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/osx-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/osx-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /Users/me/anaconda3/pkgs
/Users/me/.conda/pkgs
envs directories : /Users/me/anaconda3/envs
/Users/me/.conda/envs
platform : osx-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Darwin/19.6.0 OSX/10.15.6
UID:GID : 502:20
netrc file : None
offline mode : False
Then I downloaded osx-64/conda-4.8.3-py37_0.tar.bz2
from Anaconda here , put it into /Users/me/anaconda3/pkgs/
, and tried:
conda install /Users/me/anaconda3/pkgs/conda-4.8.3-py37_0.tar.bz2
Which resulted in this issue, where I continue to be stuck.
Preparing transaction: done
Verifying transaction: failed
RemoveError: 'conda-package-handling' is a dependency of conda and cannot be removed from
conda's operating environment.
Before marking as duplicate: consider carefully the similar posts. The version numbers here are different, the path and circumstances that resulted in this problem are different, and I have attempted those solutions without luck.
I would try downloading a standalone version of Conda that matches the old version of Conda you had (something in v4.8.x), and then try using this to upgrade the Conda package in the base env.
I don't know for sure this will work, but it is pretty simple and will not change anything unless it does work.
You can download builds of conda-standalone
(PyInstaller-based binaries) from either the Anaconda or Conda Forge channel. Browse to your version (or something close), download the archive (to wherever), unzip, and in the folder standalone_conda
you will find a conda.exe
file, which is the binary you'll need.
Next, you need to set the environment variable CONDA_ROOT_PREFIX
to point to your base env's folder, which from your output is /Users/me/anaconda3/
. So,
export CONDA_ROOT_PREFIX=/Users/me/anaconda3
Then, to test, check
./conda.exe info
and verify that the values for base environment:
, package cache:
, and envs directories
point to the correct locations, which in a default install would be /Users/me/anaconda3
, /Users/me/anaconda3/pkgs
, and /Users/me/anaconda3/envs
, respectively.
Attempt upgrading the conda
package in the base env:
./conda.exe upgrade -n base -c defaults conda
Hopefully, the error you reported before doesn't recur, but I'm actually not sure. Make sure to review any changes if the solve does work.
In the end you can discard the conda.exe
and go back to using the one in base .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.