Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you resolve Python package dependencies with pipenv?

I am using pipenv to handle Python package dependencies.

The Python package is using two packages (named pckg1 and pckg2) that rely on the same package named pckg3, but from two different versions. Showing the dependency tree :

$ pipenv graph   pckg1==3.0.0     - pckg3 [required: >=4.1.0]   pckg2==1.0.2     - pckg3 [required: ==4.0.11] 

An attempt to install dependencies :

$ pipenv install  Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies. You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation. Hint: try $ pipenv lock --pre if it is a pre-release dependency. Could not find a version that matches pckg3==4.0.11,==4.1.0,>=4.1.0 (from -r C:\Users\user\AppData\Local\Temp\pipenv-o7uxm080-requirements\pipenv-hwekv7dc-constraints.txt (line 2)) Tried: 3.3.1, 3.3.2, 3.3.3, 3.4.0, 3.4.2, 4.0.0, 4.0.0, 4.0.1, 4.0.1, 4.0.2, 4.0.2, 4.0.3, 4.0.3, 4.0.4, 4.0.4, 4.0.6, 4.0.6, 4.0.8, 4.0.8, 4.0.9, 4.0.9, 4.0.10, 4.0.10, 4.0.11, 4.0.11, 4.1.0, 4.1.0, 4.1.1, 4.1.1, 4.1.2, 4.1.2, 4.2.1, 4.2.1, 4.3.0, 4.3.0 There are incompatible versions in the resolved dependencies. 

As suggested, pip install --skip-lock does the trick, but the dependency tree is still unresolved.

I would love to tell Pipenv to override pckg2's requirement, and specify pckg3>=4.1.0.

How can this be resolved?

like image 754
Val Berthe Avatar asked Jul 26 '18 13:07

Val Berthe


People also ask

Does Pipenv install dependencies?

You can use pipenv lock to compile your dependencies on your development environment and deploy the compiled Pipfile. lock to all of your production environments for reproducible builds.


1 Answers

I get that error constantly. Clearing the cache in the lock file works beautifully every time.

$ pipenv lock --pre --clear

like image 97
arshbot Avatar answered Sep 24 '22 17:09

arshbot