Reputation: 2054
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, pipenv 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?
Upvotes: 82
Views: 92118
Reputation: 2220
This could also be because you had an old pipenv environment and you need to clean it before you create a new one.
pipenv --rm
pipenv install
Upvotes: 0
Reputation: 1696
Updating pip
inside the virtualenv worked for me: py -m pip install --upgrade pip
Upvotes: 0
Reputation: 9
pip install -U pipenv
solved for me on Ubuntu 21.04 - Hirsute Hippo - python Version 3.9.5
This command installed those packages:
Upvotes: 0
Reputation: 13
If you ran into the Locking Failed!
error:
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✘ Locking Failed!
Clearing the cache on pipfile.lock
, uninstalling your package and restarting the VM did the trick for me.
Try:
pipenv uninstall *YourPackage*
pipenv uninstall *YourPackage* --dev ##(if relevant to your package)
pipenv lock --clear
stop & destroy VM
restart VM
Hope this helps!
Upvotes: 0
Reputation: 311
Nothing here worked for me. In the end this solved the issue:
pip uninstall pipenv
pip install pipenv
Upvotes: 0
Reputation: 81
This works when there are unfinished routines on pipfile.
Once I made a mistake and run
pipenv install codecove # With an 'e' at the end
and the pipenv kept always trying to complete the installation with no success because the lib does not exist. I resolved it with:
pipenv uninstall codecove
and installed codecov after.
I tried to run
pipenv lock --clear
pipenv lock --pre --clear
but only after uninstalled the lib with wrong name I succeeded.
Upvotes: 5
Reputation: 385
On Windows 10 using VS Code I got a clean install after much messing about by running pipenv in Powershell. I also deleted all traces of the previous tries (new directory deleted the previous venvs).
Upvotes: 0
Reputation: 15795
I get that error constantly. Clearing the cache in the lock file works beautifully every time.
$ pipenv lock --pre --clear
Upvotes: 82
Reputation: 534
It happened the same to me, I'm working with Visual Studio Code and I was able to get rid o it:
and then try to install the missing dependencies for the virtual folder and good to go, it worked for me.
Upvotes: 1
Reputation: 7
pipenv lock
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, 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.
pipenv install --clean
Upvotes: -2
Reputation: 4844
If you get an error like:
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✘ Locking Failed!
For me, this happened because the underlying virtual environment did not refer to my current directory.
I solved this problem by moving the contents to a new directory and deleting the old one.
I also had to delete the Pipfile
and Pipfile.lock
but I'm not sure if that's necessary.
Upvotes: 2
Reputation: 1448
I had similar issue with glob module. I deleted glob = "*"
from Pipfile and it worked fine after that.
Error:
bash-4.2# pipenv lock --clear
Locking [dev-packages] dependencies…
✔ Success!
Locking [packages] dependencies…
✘ Locking Failed!
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
[pipenv.exceptions.ResolutionFailure]: req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]: req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]: resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches glob
[pipenv.exceptions.ResolutionFailure]: No versions found
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, 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.
ERROR: ERROR: Could not find a version that matches glob
No versions found
Was https://pypi.org/simple reachable?
[pipenv.exceptions.ResolutionFailure]: req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]: req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]: resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches glob
[pipenv.exceptions.ResolutionFailure]: No versions found
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, 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.
ERROR: ERROR: Could not find a version that matches glob
No versions found
Was https://pypi.org/simple reachable?
Upvotes: 0
Reputation: 9255
I have the similar issue with google-cloud-core
.
$ pipenv lock
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, 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 google-cloud-core<0.29dev,<0.30dev,>=0.28.0,>=0.29.0
Tried: 0.20.0, 0.20.0, 0.21.0, 0.21.0, 0.22.0, 0.22.0, 0.22.1, 0.22.1, 0.23.0, 0.23.0, 0.23.1, 0.23.1, 0.24.0, 0.24.0, 0.24.1, 0.24.1, 0.25.0, 0.25.0, 0.26.0, 0.26.0, 0.27.0, 0.27.0, 0.27.1, 0.27.1, 0.28.0, 0.28.0, 0.28.1, 0.28.1, 0.29.0, 0.29.0
There are incompatible versions in the resolved dependencies.
It was solved by
Upvotes: 3
Reputation: 66171
You can't. At the moment, pipenv
doesn't offer anything for an explicit override of requirement constraints.
As a workaround, you can put dependencies that you want to override to dev-packages
as those will be overridden by packages
, so this Pipfile
should install pckg3>=4.1.0
:
# Pipfile
...
[packages]
pckg1 = "==3.0.0"
[dev-packages]
pckg2 = "==1.0.2"
If you now lock and install:
$ pipenv lock --dev
$ pipenv install --dev
the requirement ==4.0.11
will be overridden by >=4.1.0
. This is ugly if you ask me because this is not what development packages are meant for and you're changing the role of pckg2
dependency in project, but I don't see any better way here.
Upvotes: 21