简体   繁体   English

如何解决 conda 上的 package 冲突

[英]How to solve package conflict on conda

I want to use Conda to create a virtual environment from a YAML file.我想使用 Conda 从 YAML 文件创建虚拟环境。 However, many packages end up with a Conflict error.但是,许多软件包最终都会出现冲突错误。 The best way to solve this is to install each package individually instead of creating a virtual environment from a YAML file, right?解决此问题的最佳方法是单独安装每个 package,而不是从 YAML 文件创建虚拟环境,对吧? If anyone knows of a better way to do it, please let me know.如果有人知道更好的方法,请告诉我。

Use conda-forge which has a strong dependency resolution implementation.使用具有强大依赖解析实现的 conda-forge。

Newer conda versions (>=4.6) introduced a strict channel priority feature.较新的 conda 版本 (>=4.6) 引入了严格的通道优先级功能。 Type类型

conda config --describe channel_priority

for more information.了解更多信息。

The solution is to add the conda-forge channel on top of defaults in your.condarc file when using conda-forge packages and activate the strict channel priority with:解决方案是在使用 conda-forge 包时在 your.condarc 文件中的默认值之上添加 conda-forge 通道,并通过以下方式激活严格通道优先级:

$ conda config --set channel_priority strict

This will ensure that all the dependencies will come from the conda-forge channel unless they exist only on defaults.这将确保所有依赖项都来自 conda-forge 通道,除非它们仅存在于默认值上。

You could also use Pipenv, and the Pipfile feature it comes with.您还可以使用 Pipenv 及其附带的 Pipfile 功能。 Pipenv will attempt to install sub-dependencies that satisfy all the requirements from your core dependencies. Pipenv 将尝试安装满足您的核心依赖项的所有要求的子依赖项。

see more:看更多:

https://realpython.com/pipenv-guide/ https://realpython.com/pipenv-guide/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM