因base环境Python版本问题导致Conda更新失败
问题:Conda升级与Python版本冲突排查
环境背景
- 以管理员身份在Windows 10上安装Anaconda,使用非管理员账户打开Conda提示符创建了Python 3.9的
py39环境,环境列表如下:
(base) C:\WINDOWS\system32>conda env list # conda environments: # base * C:\ProgramData\Anaconda3 C:\Users\User.Name\.conda\envs\py39
操作过程与问题出现
- 安装PySpark时,误以管理员身份在base环境执行
conda install openjdk,期间收到Conda更新提示:
==> WARNING: A newer version of conda exists. <== current version: 23.1.0 latest version: 23.5.0 Please update conda by running $ conda update -n base -c defaults conda Or to minimize the number of packages updated during conda update use conda install conda=23.5.0
- 先执行第一条更新命令
conda update -n base -c defaults conda,之后卸载base环境的openjdk,切换到非管理员账户在py39环境成功安装openjdk,但仍收到Conda更新提示。 - 再次执行第一条更新命令时,无论使用管理员还是非管理员账户,均提示
All requested packages already installed.。 - 以管理员身份执行第二条命令
conda install conda=23.5.0,出现环境冲突错误:
(base) C:\WINDOWS\system32>conda install conda=23.5.0 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. This can take several minutes. Press CTRL-C to abort. failed UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment: Specifications: - conda=23.5.0 -> python[version='>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0'] Your python: python=3.7 If python is on the left-most side of the chain, that's the version you've asked for. When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.
疑问与后续操作
- 我的理解:base环境是Python3.7,创建
py39环境就是为了不改动base环境,但疑惑为何Conda升级依赖特定环境的Python版本。请问这个理解是否正确?若不正确,该如何排查问题? - 补充说明(2023-07-06):近一周后更新完成,但base环境仍为Python3.7,因输出内容过多无法排查问题,最终卸载Anaconda,重装为Python3.10版本,重建
py39环境并重新安装Open JDK和PySpark。
内容的提问来源于stack exchange,提问作者user2153235
相关产品推荐
相关产品推荐

