创建 Conda 环境时如何修复“ResolvePackageNotFound"错误? [英] How to fix `ResolvePackageNotFound` error when creating Conda environment?

查看:246
本文介绍了创建 Conda 环境时如何修复“ResolvePackageNotFound"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行以下命令时:conda env create -f virtual_platform_mac.yml

我收到此错误

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - pytables==3.4.2=np113py35_0
  - h5py==2.7.0=np113py35_0
  - anaconda==custom=py35_0

我该如何解决这个问题?

我正在使用 Mac OS X.

I am working on Mac OS X.

推荐答案

Conda v4.7 删除了 Anaconda Cloud 存储库的一个分支,称为 free 频道,以提高求解性能.不幸的是,这包括许多从未移植到保留的存储库分支的旧包.此处失败的要求会受此影响.

Conda v4.7 dropped a branch of the Anaconda Cloud repository called the free channel for the sake of improving solving performance. Unfortunately, this includes many older packages that never got ported to the repository branches that were retained. The requirements failing here are affected by this.

Conda 提供了一种通过 restore_free_channel 配置选项恢复对存储库这一部分的访问的方法.您可以通过查看来验证这是不是问题

Conda provides a means to restore access to this part of the repository through the restore_free_channel configuration option. You can verify that this is the issue by seeing that

conda search pytables=3.4.2[build=np113py35_0]

失败,而

CONDA_RESTORE_FREE_CHANNEL=1 conda search pytables=3.4.2[build=np113py35_0]

成功找到了包,其他的也是如此.

successfully finds the package, and similarly for the others.

如果您希望经常需要较旧的软件包,则可以全局设置该选项,然后继续安装:

If you expect to frequently need older packages, then you can globally set the option and then proceed with installing:

conda config --set restore_free_channel true
conda env create -f virtual_platform_mac.yml

选项 2:临时设置

与所有 Conda 配置选项一样,您也可以使用相应的环境变量来临时恢复仅为命令的访问权限:

Option 2: Temporary Setting

As with all Conda configuration options, you can also use the corresponding environment variable to temporarily restore access just for the command:

Unix/Linux

CONDA_RESTORE_FREE_CHANNEL=1 conda env create -f virtual_platform_mac.yml

Windows

SET CONDA_RESTORE_FREE_CHANNEL=1
conda env create -f virtual_platform_mac.yaml

(是的,我意识到 ..._mac.yaml 的认知失调,但 Windows 用户也需要帮助.)

(Yes, I realize the cognitive dissonance of a ..._mac.yaml, but Windows users need help too.)

手动包含频道

也可以手动将频道包含为要搜索的频道:

One can also manually include the channel as one to be searched:

conda search -c free pytables=3.4.2[build=np113py35_0]

请注意,这些方法中的任何一种都只会在此特定搜索中使用 免费 频道,并且未来的任何搜索或对 env 的更改都不会搜索该频道.

Note that any of these approaches will only use the free channel in this particular search and any future searches or changes to the env will not search the channel.

如果您有一个特定的环境,您总是希望能够访问 免费 频道,但又不想全局设置此选项,则可以改为仅为该环境设置配置选项.

If you have a particular env that you always want to have access to the free channel but you don't want to set this option globally, you can instead set the configuration option only for the environment.

conda activate my_env
conda config --env --set restore_free_channel true

类似的效果可以通过在 etc/conda/activate.detc/conda/中的脚本中设置和取消设置 CONDA_RESTORE_FREE_CHANNEL 变量来实现deactivate.d 文件夹,分别.请参阅 the示例文档.

A similar effect can be accomplished by setting and unsetting the CONDA_RESTORE_FREE_CHANNEL variable in scripts placed in the etc/conda/activate.d and etc/conda/deactivate.d folders, respectively. See the documentation for an example.

这篇关于创建 Conda 环境时如何修复“ResolvePackageNotFound"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆