I start from a completely blank slate -- no Pipfile, no Pipfile.lock, no virtual environment. And I execute a command like
pipenv install --index <my-pypi-registry> <my-package>
where <my-pypi-registry> is a private PyPI registry (not a mirror of the public PyPI registry!) that hosts the package <my-package>.
The result of the command is:
- a virtual environment is successfully created
- and a Pipfile is generated
- but locking fails.
...
Successfully created virtual environment!
Virtualenv location: C:\tmp\tmp-venv\.venv
Creating a Pipfile for this project...
Installing <my-package>...
Adding <my-package> to Pipfile's [packages]...
Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Locking...Building requirements...
Resolving dependencies...
Locking Failed!
CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement <my-package> (from versions: none)
[ResolutionFailure]: File "c:\python391\lib\site-packages\pipenv\resolver.py", line 743, in _main
[ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]: File "c:\python391\lib\site-packages\pipenv\resolver.py", line 704, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: File "c:\python391\lib\site-packages\pipenv\resolver.py", line 685, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: File "c:\python391\lib\site-packages\pipenv\utils.py", line 1370, in resolve_deps
[ResolutionFailure]: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]: File "c:\python391\lib\site-packages\pipenv\utils.py", line 1099, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "c:\python391\lib\site-packages\pipenv\utils.py", line 877, 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: No matching distribution found for <my-package>
The generated Pipfile looks like this:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
<my-package> = {version = "*", index = "<my-pypi-registry>"}
...
That looks reasonable, but pipenv lock fails on it with the error shown above.
However, if I manually change the Pipfile to look like this, then pipenv lock succeeds, even though this seems essentially the same:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[[source]]
url = "<my-pypi-registry>"
verify_ssl = true
name = "mypypi"
[packages]
<my-package> = {version = "*", index = "mypypi"}
...
If (again starting from a completely blank slate) I replace --index with --extra-index-url, so my command looks like this:
pipenv install --extra-index-url <my-pypi-registry> <my-package>
then the command's output looks the same, meaning
- a virtual environment is successfully created
- and a Pipfile is generated
- but locking fails with the same error as above.
However, in this case, the generated Pipfile is clearly wrong, in that it doesn't reference <my-pypi-registry> at all, so it's not surprising that pipenv lock fails on it. It looks like this:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
<my-package> = "*"
...
In summary, this might be two separate bugs.
pipenv lock fails on the seemingly correct Pipfile generated by pipenv install --index ....
pipenv install --extra-index-url ... generates an incorrect Pipfile.
I'm using pipenv version 2021.11.15, which I installed using pip.
I start from a completely blank slate -- no Pipfile, no Pipfile.lock, no virtual environment. And I execute a command like
where
<my-pypi-registry>is a private PyPI registry (not a mirror of the public PyPI registry!) that hosts the package<my-package>.The result of the command is:
The generated Pipfile looks like this:
That looks reasonable, but
pipenv lockfails on it with the error shown above.However, if I manually change the Pipfile to look like this, then
pipenv locksucceeds, even though this seems essentially the same:If (again starting from a completely blank slate) I replace
--indexwith--extra-index-url, so my command looks like this:then the command's output looks the same, meaning
However, in this case, the generated Pipfile is clearly wrong, in that it doesn't reference <my-pypi-registry> at all, so it's not surprising that
pipenv lockfails on it. It looks like this:In summary, this might be two separate bugs.
pipenv lockfails on the seemingly correct Pipfile generated bypipenv install --index ....pipenv install --extra-index-url ...generates an incorrect Pipfile.I'm using pipenv version 2021.11.15, which I installed using pip.