Pipenv lock fails for packages with extras as of 2022.8.13
See original GitHub issueIssue description
There was a regression in the ability to lock Pipfiles containing packages with extras on the 2022.8.13 release. This was working fine on versions prior to 2022.8.13. I believe this is as a result of the changes introduced in #5234
Expected result
Given the Pipfile in the replicate section, it should lock, showing
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Updated Pipfile.lock (3e8e27)!
Actual result
[ResolutionFailure]: File "***.venv/lib/python3.10/site-packages/pipenv/resolver.py", line 824, in _main
[ResolutionFailure]: resolve_packages(
[ResolutionFailure]: File "***.venv/lib/python3.10/site-packages/pipenv/resolver.py", line 772, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: File "***.venv/lib/python3.10/site-packages/pipenv/resolver.py", line 751, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: File "***.venv/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 1126, in resolve_deps
[ResolutionFailure]: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]: File "***.venv/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 919, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "***.venv/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 723, in resolve
[ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: 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.
ERROR: Constraints cannot have extras
Steps to replicate
With the following Pipfile
[packages]
"uvicorn[standard]" = "~=0.18.2"
[dev-packages]
pytest = "~=7.1.1"
[requires]
python_version = "3.9"
Run pipenv lock
Note that there is a package with ‘extras’, namely uvicorn[standard]. This issue does not occur with normal packages.
The change to lock the packages first and then treat that lock as constraints for the dev packages seems to raise the exception that the extras are not allowed.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:33 (8 by maintainers)
Top Results From Across the Web
Release and Version History — pipenv 2022.12.20.dev0 ...
Fix for pipenv lock fails for packages with extras as of 2022.8.13 . #5274. Revert the exclusion of BAD_PACKAGES from batch_install in order...
Read more >pipenv Documentation - Read the Docs
Fix for pipenv lock fails for packages with extras as of 2022.8.13. #5274. • Revert the exclusion of BAD_PACKAGES from batch_install in order...
Read more >How to fix locking failed in pipenv? - Stack Overflow
It seems like a library is requiring a version >= importlib-metadata 2.0 . When I pinned the following dependencies it didn't work at...
Read more >pipenv · PyPI
shell Spawns a shell within the virtualenv. sync Installs all packages specified in Pipfile.lock. uninstall Uninstalls a provided package and removes it from ......
Read more >Common Pipenv Errors and How to Solve Them: Why Won't it ...
Pipfile Management: Specifying Versions ... The second most common reason locking fails is that we attempt to install a package that is a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Or maybe I’m wrong,
PipDeprecationWarning
says Constraints are only allowed to take the form of a package name and a version specifier so it should not containts url. In that case we could easily fix that by usingnew_dep.is_named
.But the documentation does not say that. So maybe it could have url as constraints? I tried using this constraints file with
pip
and it did work.@dqkqd I found this interesting and has a lot of context: https://github.com/pypa/pip/issues/8210
That was a long read, but the conclusion is that “unnamed constraints are not allowed.”