Local inter-dependency resolution fails
See original GitHub issueIssue description
Lets say I have two local dependencies, where one of the packages depends on the other:
[packages]
test-package-pipenv-base = {path = "./test_package_pipenv_base"}
test-package-pipenv-with-dependency = {path = "./test_package_pipenv_with_dependency"}
This basically works (pipenv install --skip-lock
will install everything into the environment just fine), but pipenv lock
fails.
pipenv.exceptions.ResolutionFailure: ERROR: Could not find a version that matches test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
No versions found
Was https://pypi.org/si
Expected result
This should work. Dependency resolution should identify that the package is sourced locally and not try to source it from upstream repos.
This works fine when installing a requirements.txt file with inter-dependent local packages.
Actual result
pipenv lock --verbose
:
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
⠇ Locking...
ROUND 1
✘ Locking Failed!
Current constraints:
requests (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 3))
test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
Finding the best candidates:
found candidate requests==2.26.0 (constraint was <any>)
Traceback (most recent call last):
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 825, in resolve
results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 180, in resolve
has_changed, best_matches = self._resolve_one_round()
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 260, in _resolve_one_round
best_matches = {self.get_best_match(ireq) for ireq in constraints}
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 260, in <setcomp>
best_matches = {self.get_best_match(ireq) for ireq in constraints}
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 319, in get_best_match
best_match = self.repository.find_best_match(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 205, in find_best_match
raise NoCandidateFound(ireq, all_candidates, self.finder)
pipenv.patched.piptools.exceptions.NoCandidateFound: Could not find a version that matches test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 764, in <module>
main()
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 758, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 741, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 702, in resolve_packages
results, resolver = resolve(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 684, in resolve
return resolve_deps(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 1397, in resolve_deps
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 1110, in actually_resolve_deps
resolver.resolve()
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 835, in resolve
raise ResolutionFailure(message=str(e))
pipenv.exceptions.ResolutionFailure: ERROR: Could not find a version that matches test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
ROUND 1
Current constraints:
requests (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 3))
test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
Finding the best candidates:
found candidate requests==2.26.0 (constraint was <any>)
Traceback (most recent call last):
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 825, in resolve
results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 180, in resolve
has_changed, best_matches = self._resolve_one_round()
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 260, in _resolve_one_round
best_matches = {self.get_best_match(ireq) for ireq in constraints}
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 260, in <setcomp>
best_matches = {self.get_best_match(ireq) for ireq in constraints}
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/resolver.py", line 319, in get_best_match
best_match = self.repository.find_best_match(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 205, in find_best_match
raise NoCandidateFound(ireq, all_candidates, self.finder)
pipenv.patched.piptools.exceptions.NoCandidateFound: Could not find a version that matches test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 764, in <module>
main()
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 758, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 741, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 702, in resolve_packages
results, resolver = resolve(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 684, in resolve
return resolve_deps(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 1397, in resolve_deps
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 1110, in actually_resolve_deps
resolver.resolve()
File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 835, in resolve
raise ResolutionFailure(message=str(e))
pipenv.exceptions.ResolutionFailure: ERROR: Could not find a version that matches test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenve4tn0hajrequirements/pipenv-4pdm4ur9-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
The FAQ says to try pipenv lock --clear
:
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
[ResolutionFailure]: File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 741, in _main
[ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]: File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 702, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/resolver.py", line 684, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 1397, in resolve_deps
[ResolutionFailure]: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]: File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 1110, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv/utils.py", line 835, 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.
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: Could not find a version that matches test_package_pipenv_base (from -r /var/folders/55/rh929wp96y71h796rv7tddl00000gn/T/pipenv0chdv3kgrequirements/pipenv-5y6vxldn-constraints.txt (line 2))
No versions found
Was https://pypi.org/simple reachable?
Steps to replicate
- Create two local packages (name them anything, but the names must NOT exist in PyPi)
- Setup the second package to depend on the first (setup.py)
pipenv install --skip-lock <package1> <package2>
# should workpipenv lock
# error
Note: both pipenv graph
and pip freeze
show the environment has the correct packages:
pipenv graph
test-package-pipenv-with-dependency==0.1
- test-package-pipenv-base [required: Any, installed: 0.1]
- requests [required: Any, installed: 2.26.0]
- certifi [required: >=2017.4.17, installed: 2021.5.30]
- charset-normalizer [required: ~=2.0.0, installed: 2.0.4]
- idna [required: >=2.5,<4, installed: 3.2]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.6]
pipenv run pip freeze
certifi==2021.5.30
charset-normalizer==2.0.4
idna==3.2
requests==2.26.0
test-package-pipenv-base @ file:///issue/test_package_pipenv_base
test-package-pipenv-with-dependency @ file:///issue/test_package_pipenv_with_dependency
urllib3==1.26.6
Please run $ pipenv --support
, and paste the results here. Don’t put backticks (`
) around it! The output already contains Markdown formatting.
$ pipenv --support
Pipenv version: '2021.5.29'
Pipenv location: '/Users/user1/.pyenv/versions/3.8.9/lib/python3.8/site-packages/pipenv'
Python location: '/Users/user1/.pyenv/versions/3.8.9/bin/python3.8'
Python installations found:
3.9.6
:/usr/local/bin/python3
3.9.6
:/usr/local/bin/python3.9
3.8.9
:/Users/user1/.pyenv/versions/3.8.9/bin/python3
3.8.9
:/Users/user1/.pyenv/versions/3.8.9/bin/python3
3.8.9
:/Users/user1/.pyenv/versions/3.8.9/bin/python3.8
3.8.2
:/usr/bin/python3
2.7.16
:/usr/bin/python2
2.7.16
:/usr/bin/python2.7
Contents of Pipfile
(‘/issue/Pipfile’):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
test-package-pipenv-base = {path = "./test_package_pipenv_base"}
test-package-pipenv-with-dependency = {path = "./test_package_pipenv_with_dependency"}
[dev-packages]
[requires]
python_version = "3.8"
Contents of Pipfile.lock
(‘/issue/Pipfile.lock’):
{
"_meta": {
"hash": {
"sha256": "fa874ddda6051420be8b7056cdf0f937e60586ab4b7f56d0c552bd25a81d06da"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"certifi": {
"hashes": [
"sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee",
"sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8"
],
"version": "==2021.5.30"
},
"charset-normalizer": {
"hashes": [
"sha256:0c8911edd15d19223366a194a513099a302055a962bca2cec0f54b8b63175d8b",
"sha256:f23667ebe1084be45f6ae0538e4a5a865206544097e4e8bbcacf42cd02a348f3"
],
"markers": "python_version >= '3'",
"version": "==2.0.4"
},
"idna": {
"hashes": [
"sha256:14475042e284991034cb48e06f6851428fb14c4dc953acd9be9a5e95c7b6dd7a",
"sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"
],
"markers": "python_version >= '3'",
"version": "==3.2"
},
"requests": {
"hashes": [
"sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24",
"sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
"version": "==2.26.0"
},
"test-package-pipenv-base": {
"path": "./test_package_pipenv_base",
"version": "==0.1"
},
"urllib3": {
"hashes": [
"sha256:39fb8672126159acb139a7718dd10806104dec1e2f0f6c88aab05d17df10c8d4",
"sha256:f57b4c16c62fa2760b7e3d97c35b255512fb6b59a259730f36ba32ce9f8e342f"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.26.6"
}
},
"develop": {}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8
Top GitHub Comments
Also this might be a duplicate of #4553
I have just made a code change that makes it work without adding the editable flag. https://github.com/pypa/pipenv/pull/5342