Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip's dependency resolver takes way too long to solve the conflict

I've been trying to install a package through pip on my rpi 3 model B my operating system is raspbian. Debian based pip version is 21.0.1 and python version is 3.7.4 the command I'm using is:

python3 -m pip install librosa

the problem is that the dependency resolver takes way too long to resolve the conflicts. and after a few hours, it keeps repeating this line over and over again for hours ( I even left the installation running for 2 days overnights )

INFO: pip is looking at multiple versions of <Python from requires-Python> to determine which version is compatible with other requirements. this could take a while.
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run you can press ctrl + c to do so.

I've tried using a stricter constraint such as adding "numpy > 1.20.0" and other stuff but now the popped up and I have no clue what I can do now.

like image 985
אופק כהן Avatar asked Feb 02 '21 11:02

אופק כהן


People also ask

How does pip dependency solve conflict?

Unfortunately, pip makes no attempt to resolve dependency conflicts. For example, if you install two packages, package A may require a different version of a dependency than package B requires. Pip can install from either Source Distributions (sdist) or Wheel (. whl) files.

What is pip dependency resolver?

pip is capable of determining and installing the dependencies of packages. The process of determining which version of a dependency to install is known as dependency resolution. This behaviour can be disabled by passing --no-deps to pip install.

Does pip check for dependencies?

Because pip doesn't currently address dependency issues on installation, the pip check command option can be used to verify that dependencies have been installed properly in your project.

What is pip compile?

The pip-compile command lets you compile a requirements. txt file from your dependencies, specified in either setup.py or requirements.in. Run it with pip-compile or python -m piptools compile. If you use multiple Python versions, you can also run py -X.Y -m piptools compile on Windows and pythonX.

What is dependency resolution in Pip?

pip is capable of determining and installing the dependencies of packages. The process of determining which version of a dependency to install is known as dependency resolution. This behaviour can be disabled by passing --no-deps to pip install.

Does Pip's dependency resolver take into account all the installed packages?

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed.

Why does Pip take so long to install some packages?

If pip is taking longer to install packages, read Dependency resolution backtracking for ways to reduce the time pip spends backtracking due to dependency conflicts. If you don’t want pip to actually resolve dependencies, use the --no-deps option.

Why is my dependency resolver taking so long?

This could take a while. INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so.


Video Answer


1 Answers

So as of pip 20.3, a new (not always working) resolver has been introduced. As of pip 21.0 the old (working) resolver is unsupported and slated for removal dependent on pip team resources.

Changes to the pip dependency resolver in 20.3

I have hit the same issue trying to build jupyter, my solution was to pin pip back to the 20.2 release which is the last release with the old resolver. This got past the point my builds were choking at using the new resolver under pip 21.1.1.

A second approach that might work (untested) is to use the flag:

--use-deprecated=legacy-resolver

which appears to have been added when 20.3 switched over to the new resolver. This would allow the benefits of newer pip releases, until the backtracking issue is resolved, assuming it works.

like image 114
Bill Gale Avatar answered Sep 28 '22 16:09

Bill Gale