How to solve package conflict on conda

Viewed 8639

I want to use Conda to create a virtual environment from a YAML file. 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? If anyone knows of a better way to do it, please let me know.

1 Answers

Use conda-forge which has a strong dependency resolution implementation.

Newer conda versions (>=4.6) introduced a strict channel priority feature. 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 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.

You could also use Pipenv, and the Pipfile feature it comes with. Pipenv will attempt to install sub-dependencies that satisfy all the requirements from your core dependencies.

see more:

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

Related