Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local wheel Installation failure due to path removal in Pipfile.lock #5542

Closed
JGSweets opened this issue Dec 16, 2022 · 9 comments
Closed

Local wheel Installation failure due to path removal in Pipfile.lock #5542

JGSweets opened this issue Dec 16, 2022 · 9 comments
Labels
Category: Tests Relates to tests. triage

Comments

@JGSweets
Copy link

JGSweets commented Dec 16, 2022

Issue description

This issue was introduced within the PR #5464
The lines:

if not keep_outdated:
    try:
        del lockfile[category]
    except KeyError:
        pass

forces the category to be resolved latter. This strips the path key for local packages which does not get reintroduced into the lockfile later. This causes a cannot resolve package error during installation despite Pipfile.lock being created.

i.e. the Pipfile.lock for the <LOCAL_PACKAGE> loses the path.

"<LOCAL_PACKAGE>": {
    "hashes": [
        "sha256:<VALUE>"
    ],
    "path": "<PATH>"
}

becomes

"<LOCAL_PACKAGE>": {
    "hashes": [
        "sha256:<VALUE>"
    ]
}

Expected result

Pipfile.lock should maintain the path key for locally installed packages.

Actual result

[pipenv.exceptions.InstallError]: ERROR: Could not find a version that satisfies the requirement my-package (from versions: none)
[pipenv.exceptions.InstallError]: ERROR: No matching distribution found for my-package

Steps to replicate

  1. Create a Pipfile which contains a path to a local package.
    e.g.
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
my-package = {path = "./path/to/my-package.whl"}
  1. Run pipenv install

$ pipenv --support

Pipenv version: '2022.11.30' # NOTE: Tested around 2022.11.11 and 2022.11.5 to identify.

Pipenv location: '/usr/local/lib/python3.10/site-packages/pipenv'

Python location: '/usr/local/opt/python@3.10/bin/python3.10'

OS Name: 'posix'

User pip version: '22.3'

user Python installations found:

  • 3.10.8: /usr/local/bin/python3
  • 3.9.16: /usr/local/bin/python3.9
  • 3.8.16: /usr/local/bin/python3.8

Limited output...

@JGSweets JGSweets mentioned this issue Dec 16, 2022
@matteius
Copy link
Member

Have you tried the main branch?

@matteius
Copy link
Member

Ok to my surprise, this appears to be an issue even on main. I thought this would have fixed it: #5523

@matteius
Copy link
Member

I see the issue -- you named it my-package but there is this logic that converts to pep423_name which converts dashes to underscores. If in my example I change my-package to requests to match the wheel I am installing, then it works on main branch. Let me know if you can try main branch if your example still has an issue; we plan to do another release soon.

@JGSweets
Copy link
Author

I can check tomorrow, thanks for the quick responses!

@matteius
Copy link
Member

New version has been released so you can try it from pypi install.

@matteius matteius added triage Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided. labels Dec 17, 2022
@JGSweets
Copy link
Author

New version has been released so you can try it from pypi install.

Looks resolved on my end!

@JGSweets
Copy link
Author

Would there be need to add a test for coverage or did the PR that fixed the issue include enough coverage wrt this issue?

@matteius
Copy link
Member

There was a test scenario added for file but not path -- we should probably add one for path as well: https://github.com/pypa/pipenv/pull/5523/files

@matteius matteius added Category: Tests Relates to tests. and removed Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided. labels Dec 23, 2022
@matteius
Copy link
Member

Non trivial to add a test for path because path is relative and by the time the test runner invokes and makes temp directories, its impossible to know the relative pathing to the test wheel for install and actually have it resolve via lock, without making an absolute file path which we already have a test for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Tests Relates to tests. triage
Projects
None yet
Development

No branches or pull requests

2 participants