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

Can't find .dist-info for package with local version string #2424

Closed
jasonprado opened this issue Mar 13, 2024 · 6 comments · Fixed by #2441
Closed

Can't find .dist-info for package with local version string #2424

jasonprado opened this issue Mar 13, 2024 · 6 comments · Fixed by #2441
Assignees
Labels
bug Something isn't working

Comments

@jasonprado
Copy link

My requirements.txt has this:

my-package==2024.3.13+0873c15

When I uv pip install -r requirements.txt:

error: Failed to download: my-package==2024.3.13+0873c15
  Caused by: No .dist-info directory found

If I expand the whl, I see this dir:

my_package-2024.3.13_0873c15.dist-info

The + is being converted to a _. I suspect that is why they dist-info can't be found. There is kind of a mess of Python version strings where + is a legal part of a version string denoting a local version, but it isn't allowed in the name of the .dist-info dir.

Running version 0.1.18 in a docker Linux shell.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 13, 2024
@jasonprado
Copy link
Author

One thing I notice is that pip is not considering the package version in looking for the `.dist-info: https://github.com/pypa/pip/blob/36823099a9cdd83261fdbc8c1d2a24fa2eea72ca/src/pip/_internal/utils/wheel.py#L60

But uv is:

if Version::from_str(version).ok()? != filename.version {

Perhaps a solution for uv is asserting that there is only one .dist-info present and that its path starts with the canonical name of the package, like pip.

@charliermarsh
Copy link
Member

I'll take a look!

@charliermarsh charliermarsh self-assigned this Mar 14, 2024
@charliermarsh
Copy link
Member

My read of the spec is that it should still retain the +... I can't see why not? The + isn't removed during version normalization as in https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers-normalization. But we should make our processing more lax.

@charliermarsh
Copy link
Member

Are you able to share how you're building your wheel? E.g. which tool?

charliermarsh added a commit that referenced this issue Mar 14, 2024
## Summary

It turns out that pip does _not_ validate the normalization of the
version specifier in the `.dist-info` directory. In particular, it seems
that some tools replace the `+` in a local version segment with a `_`.

Closes #2424.
@jasonprado
Copy link
Author

Thanks for submitting a fix. I'll try it out ASAP.

I thought I found some documentation saying that the prefix to .dist-info only allowed _-. and not + but I can't find that source now. We are using bazel with the aspect_rules_py package.

@jasonprado
Copy link
Author

0.1.21 works in our environment at flyzipline.com. Thanks! I'll start looking at migrating over to uv soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants