do PIP and Conda have conflicts?

Viewed 210

In some documents and resources, it has been noted that installing packages using pip after installing conda could cause some problems like crashing conda and so on. could anybody tell me when and in which cases is that happening? I tried pip for some packages due to the smallness of conda's repository and I found no problem using both together.

I'm using pip 21.1.2 and conda 4.10.1.

1 Answers

The point is that pip is less strict wrt. to dependency checks, so it's clearly better to prioritize conda installs over pip:

"Pip and conda differ in how dependency relationships within an environment are fulfilled. When installing packages, pip installs dependencies in a recursive, serial loop. No effort is made to ensure that the dependencies of all packages are fulfilled simultaneously. This can lead to environments that are broken in subtle ways, if packages installed earlier in the order have incompatible dependency versions relative to packages installed later in the order. In contrast, conda uses a satisfiability (SAT) solver to verify that all requirements of all packages installed in an environment are met. This check can take extra time but helps prevent the creation of broken environments." (https://www.anaconda.com/blog/understanding-conda-and-pip)

However, some packages are only available via PyPI, and you have to resort to pip. In that case stick to the best practices as recommended in the conda docs. (https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#using-pip-in-an-environment)

So far I never experienced any inconsistencies with conda and pip installs myself, and when you are a serious programmer and have your test suites properly set up, you'll anyhow get aware of issues well in advance and before they can cause any trouble.

Related