错误日志:Solving environment: failed with initial frozen solve. Retrying with flexible solve.

Reference:

  1. (已解决)Solving environment: failed with initial frozen solve. Retrying with flexible solve.

背景

经常在使用 conda 安装新的包的时候,比如以下命令:

conda install opencv

会报出上述错误:
先是

Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.

紧接着:

Found conflicts! Looking for incompatible packages.

最后:

failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

耗时耗力,非常可恶。

原因

因为是在科学上网的方式下进行的,所以不存在需要切换源的问题。网上别人写的的基本没用。

根据 (已解决)Solving environment: failed with initial frozen solve. Retrying with flexible solve. 文章所说,这里的理解是:现在安装的包,其所依赖的环境有点难解决。什么叫难解决,比如现在这个包依赖很多包,然后这些被依赖的包版本都不满足要求,有的可能需要更新,有的可能你又安装过高了,需要安装更低版本,但是如果你安装更低版本,依赖这个包的一些包又会不舒服。

解决方案

基本没想到什么好的解决方案,目前已知的就两种:

  1. 使用 conda create --name 再额外创建一个环境,新环境就不会有依赖问题了。
  2. 直接使用 pip 安装,由于 pip 不检查依赖,会存在包之间的兼容性问题,比如当前安装的 pkg 是可以用的,但以前安装的由无法使用的风险。
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐