出于某种原因,我决定升级setuptools
。我运行conda install -c anaconda setuptools
时弹出的所谓打包计划如下:
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2019.3.9 | py37_0 155 KB anaconda
pip-19.1.1 | py37_0 1.8 MB anaconda
python-3.7.2 | h8c8aaf0_10 17.7 MB anaconda
setuptools-41.0.1 | py37_0 680 KB anaconda
wheel-0.33.4 | py37_0 57 KB anaconda
wincertstore-0.2 | py37_0 13 KB anaconda
------------------------------------------------------------
Total: 20.4 MB
The following NEW packages will be INSTALLED:
pip anaconda/win-64::pip-19.1.1-py37_0
The following packages will be UPDATED:
certifi 2018.11.29-py36_0 --> 2019.3.9-py37_0
python pkgs/main::python-3.6.4-h6538335_1 --> anaconda::python-3.7.2-h8c8aaf0_10
setuptools pkgs/main::setuptools-38.4.0-py36_0 --> anaconda::setuptools-41.0.1-py37_0
wheel pkgs/main::wheel-0.30.0-py36h6c3ec14_1 --> anaconda::wheel-0.33.4-py37_0
The following packages will be SUPERSEDED by a higher-priority channel:
wincertstore pkgs/main::wincertstore-0.2-py36h7fe5~ --> anaconda::wincertstore-0.2-py37_0
但是,升级破坏了我代码的其他真正需要的部分,无法更新。因此,我决定回滚到以前的状态。 conda list --revisions
的最新修订为:
2019-02-12 15:10:38 (rev 12)
bzip2 {1.0.6 (conda-forge) -> 1.0.6 (anaconda)}
ca-certificates {2018.03.07 -> 2019.1.23 (anaconda)}
certifi {2018.11.29 -> 2018.11.29 (anaconda)}
conda {4.5.12 -> 4.6.2 (anaconda)}
nbconvert {5.3.1 -> 5.4.0 (anaconda)}
openssl {1.1.1a -> 1.1.1 (anaconda)}
snappy {1.1.7 (conda-forge) -> 1.1.7 (anaconda)}
vc {14.1 -> 14.1 (anaconda)}
vs2015_runtime {14.15.26706 -> 15.5.2 (anaconda)}
yaml {0.1.7 (conda-forge) -> 0.1.7 (anaconda)}
zlib {1.2.11 (conda-forge) -> 1.2.11 (anaconda)}
+defusedxml-0.5.0 (anaconda)
2019-05-17 16:52:29 (rev 13)
certifi {2018.11.29 (anaconda) -> 2019.3.9 (anaconda)}
pip {9.0.1 -> 19.1.1 (anaconda)}
python {3.6.4 -> 3.7.2 (anaconda)}
setuptools {38.4.0 -> 41.0.1 (anaconda)}
wheel {0.30.0 -> 0.33.4 (anaconda)}
wincertstore {0.2 -> 0.2 (anaconda)}
现在的问题是,当我执行conda install --revision 12
时,出现以下错误:
PackagesNotFoundError: The following packages are missing from the target environment:
- anaconda::certifi==2018.11.29=py36_0
请问如何进行回滚的任何想法?
非常感谢
答案 0 :(得分:0)
是的,这可能很痛苦。
看来您正在维护环境
发出一系列conda install
命令。
您可以继续这样做,
在命令行上带有附加的版本说明。
但我鼓励您改用这种方法:
创建一个如下所示的environment.yml
文件。
name: myproject
channels:
- defaults
- conda-forge
dependencies:
- bzip2 >= 1.0.6
- pip >= 19.1.1
- snappy >= 1.1.7
- zlib >= 1.2.11
根据需要添加其他人。
使用conda env update
安装软件包。
(通过which python
,您可以看到它们的安装位置。)
此方法的优点是您可以轻松地
rm -rf ~/miniconda3/envs/myproject/
(或安装它们的任何地方)
然后conda env update
重新安装。
这通常可以解决版本炎问题,
或至少提供提示
关于应该放宽哪些版本限制
提供可行的解决方案。
答案 1 :(得分:0)
万一有人碰到这种情况,面对类似的情况,这就是我所做的,并且公平地说,这实际上不是回滚。看来我的conda环境真的搞砸了我在原始帖子中提到的升级,因为当我做conda update conda
时,我收到以下错误:
>conda update conda
Collecting package metadata: done
Solving environment: | WARNING
conda.common.logic:get_sat_solver_cls(289): Could not run SAT solver through interface "pycosat".
WARNING conda.common.logic:get_sat_solver_cls(289): Could not run SAT solver through interface "pycryptosat".
WARNING conda.common.logic:get_sat_solver_cls(289): Could not run SAT solver through interface "pysat".failed
我的麻木也坏了,谁知道呢...
我在以下链接上遵循了Kale Franz所描述的步骤:https://github.com/conda/conda/issues/7714#issuecomment-417553149
运行Kale在他的帖子中建议的命令,我得到了一堆导致不一致的软件包的清单。我的名单很长,我只粘贴了下面几行:
Collecting package metadata: done
Solving environment: \
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:
- defaults/win-64::alabaster==0.7.10=py36hcd07829_0
- defaults/win-64::anaconda-client==1.6.9=py36_0
- defaults/win-64::anaconda==custom=py36h363777c_0
- defaults/win-64::anaconda-project==0.8.2=py36hfad2e28_0
- defaults/win-64::asn1crypto==0.24.0=py36_0
- defaults/win-64::astroid==1.6.1=py36_0
.... (A lot more that I am not pasting here) ....
列表结束后,消息继续如下:
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2019.5.15 | 0 166 KB
certifi-2019.3.9 | py36_0 156 KB
cffi-1.12.3 | py36h7a1dbc1_0 225 KB
chardet-3.0.4 | py36_1 210 KB
conda-4.6.14 | py36_0 2.1 MB
cryptography-2.7 | py36h7a1dbc1_0 564 KB
idna-2.8 | py36_0 134 KB
menuinst-1.4.16 | py36he774522_0 227 KB
openssl-1.1.1c | he774522_1 5.7 MB
pip-19.1.1 | py36_0 1.9 MB
pycosat-0.6.3 | py36hfa6e2cd_0 98 KB
pycparser-2.19 | py36_0 174 KB
pyopenssl-19.0.0 | py36_0 82 KB
pysocks-1.7.0 | py36_0 30 KB
python-3.6.8 | h9f7ef89_7 20.3 MB
pywin32-223 | py36hfa6e2cd_1 9.3 MB
requests-2.22.0 | py36_0 90 KB
ruamel_yaml-0.15.46 | py36hfa6e2cd_0 262 KB
setuptools-41.0.1 | py36_0 663 KB
six-1.12.0 | py36_0 22 KB
urllib3-1.24.2 | py36_0 153 KB
wheel-0.33.4 | py36_0 57 KB
win_inet_pton-1.1.0 | py36_0 9 KB
wincertstore-0.2 | py36h7fe50ca_0 13 KB
------------------------------------------------------------
Total: 42.6 MB
The following packages will be UPDATED:
ca-certificates anaconda::ca-certificates-2019.1.23-0 --> pkgs/main::ca-certificates-2019.5.15-0
cffi 1.11.4-py36hfa6e2cd_0 --> 1.12.3-py36h7a1dbc1_0
conda anaconda::conda-4.6.2-py36_0 --> pkgs/main::conda-4.6.14-py36_0
cryptography 2.4.2-py36h7a1dbc1_0 --> 2.7-py36h7a1dbc1_0
idna 2.6-py36h148d497_1 --> 2.8-py36_0
menuinst 1.4.11-py36hfa6e2cd_0 --> 1.4.16-py36he774522_0
pycparser 2.18-py36hd053e01_1 --> 2.19-py36_0
pyopenssl 17.5.0-py36h5b7d817_0 --> 19.0.0-py36_0
pysocks 1.6.7-py36h698d350_1 --> 1.7.0-py36_0
pywin32 222-py36hfa6e2cd_0 --> 223-py36hfa6e2cd_1
requests 2.18.4-py36h4371aae_1 --> 2.22.0-py36_0
ruamel_yaml 0.15.35-py36hfa6e2cd_1 --> 0.15.46-py36hfa6e2cd_0
six 1.11.0-py36h4db2310_1 --> 1.12.0-py36_0
urllib3 1.22-py36h276f60a_0 --> 1.24.2-py36_0
win_inet_pton 1.0.1-py36he67d7fd_1 --> 1.1.0-py36_0
The following packages will be SUPERSEDED by a higher-priority channel:
certifi anaconda::certifi-2019.3.9-py37_0 --> pkgs/main::certifi-2019.3.9-py36_0
openssl anaconda::openssl-1.1.1-he774522_0 --> pkgs/main::openssl-1.1.1c-he774522_1
pip anaconda::pip-19.1.1-py37_0 --> pkgs/main::pip-19.1.1-py36_0
python anaconda::python-3.7.2-h8c8aaf0_10 --> pkgs/main::python-3.6.8-h9f7ef89_7
setuptools anaconda::setuptools-41.0.1-py37_0 --> pkgs/main::setuptools-41.0.1-py36_0
wheel anaconda::wheel-0.33.4-py37_0 --> pkgs/main::wheel-0.33.4-py36_0
wincertstore anaconda::wincertstore-0.2-py37_0 --> pkgs/main::wincertstore-0.2-py36h7fe50ca_0
The following packages will be DOWNGRADED:
chardet 3.0.4-py36h420ce6e_1 --> 3.0.4-py36_1
pycosat 0.6.3-py36h413d8a4_0 --> 0.6.3-py36hfa6e2cd_0
Proceed ([y]/n)? y
现在一切都很好,如果我conda list --revisions
,我的两个最新修订是:
2019-05-17 16:52:29 (rev 13)
certifi {2018.11.29 (anaconda) -> 2019.3.9 (anaconda)}
pip {9.0.1 -> 19.1.1 (anaconda)}
python {3.6.4 -> 3.7.2 (anaconda)}
setuptools {38.4.0 -> 41.0.1 (anaconda)}
wheel {0.30.0 -> 0.33.4 (anaconda)}
wincertstore {0.2 -> 0.2 (anaconda)}
2019-06-10 14:05:10 (rev 14)
ca-certificates {2019.1.23 (anaconda) -> 2019.5.15}
certifi {2019.3.9 (anaconda) -> 2019.3.9}
cffi {1.11.4 -> 1.12.3}
chardet {3.0.4 -> 3.0.4}
conda {4.6.2 (anaconda) -> 4.6.14}
cryptography {2.4.2 -> 2.7}
idna {2.6 -> 2.8}
menuinst {1.4.11 -> 1.4.16}
openssl {1.1.1 (anaconda) -> 1.1.1c}
pip {19.1.1 (anaconda) -> 19.1.1}
pycosat {0.6.3 -> 0.6.3}
pycparser {2.18 -> 2.19}
pyopenssl {17.5.0 -> 19.0.0}
pysocks {1.6.7 -> 1.7.0}
python {3.7.2 (anaconda) -> 3.6.8}
pywin32 {222 -> 223}
requests {2.18.4 -> 2.22.0}
ruamel_yaml {0.15.35 -> 0.15.46}
setuptools {41.0.1 (anaconda) -> 41.0.1}
six {1.11.0 -> 1.12.0}
urllib3 {1.22 -> 1.24.2}
wheel {0.33.4 (anaconda) -> 0.33.4}
win_inet_pton {1.0.1 -> 1.1.0}
wincertstore {0.2 (anaconda) -> 0.2}
答案 2 :(得分:0)
我同意J_H,最好是将由conda env export > environment.yml
生成的environment.yml保留在代码版本控制系统(Git)中。然后,如果出现问题,您可以使用conda env update
删除并重新创建环境(但不能使用conda env create -f environment.yml
)。