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

Invalid version identifiers and names starting with pip 24.x? #235

Open
Vodes opened this issue Sep 23, 2024 · 6 comments
Open

Invalid version identifiers and names starting with pip 24.x? #235

Vodes opened this issue Sep 23, 2024 · 6 comments

Comments

@Vodes
Copy link

Vodes commented Sep 23, 2024

This has come up a few times on the JET server and even in my DMs so I thought it'd be best to make an issue now.

Starting with pip 24.2 (or 24.3, not sure), proper version identifiers and names for python package metadata have been enforced.
This results in an actual error when doing anything with pip and should be addressed ASAP.

Doesn't seem to be affecting all plugins but it might be a good idea to rethink how the metadata gets generated in general.

One such error
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python312\Lib\site-packages\pip\_internal\cli\base_command.py", line 105, in _run_wrapper
    status = _inner_run()
             ^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\pip\_internal\cli\base_command.py", line 96, in _inner_run
    return self.run(options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\pip\_internal\cli\req_command.py", line 67, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\pip\_internal\commands\install.py", line 483, in run
    installed_versions[distribution.canonical_name] = distribution.version
                                                      ^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\pip\_internal\metadata\importlib\_dists.py", line 167, in version
    return parse_version(version)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\pip\_vendor\packaging\version.py", line 56, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\pip\_vendor\packaging\version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pip._vendor.packaging.version.InvalidVersion: Invalid version: 'Reader__IMWRI-2'
WARNING: Error parsing dependencies of imagemagick-writer: Invalid version: 'Reader__IMWRI-2'
@Vodes
Copy link
Author

Vodes commented Nov 18, 2024

Actually somewhat urgent as it's more likely to have an updated pip version as time goes on 🙂

@theChaosCoder
Copy link
Collaborator

How would a fix look like? Replace all - with _ ?

@Vodes
Copy link
Author

Vodes commented Nov 18, 2024

Looking at https://peps.python.org/pep-0440/ that wouldn't be valid either.
Also just noticed there's some pep440 regex stuff already in the code so I'm not even sure how stuff like this ends up in there
image

@theChaosCoder
Copy link
Collaborator

get_python_package_name() is responsible for the python package name

But how to trigger the error? I'm on pip 24.3.1 and everything is fine for me.

@Vodes
Copy link
Author

Vodes commented Nov 18, 2024

I don't have a system with vsrepo on hand but last time I had the issue you'd always get that when trying to install something via pip.

Fyi that screenshot isn't mine. It's someone on the GJM discord and they just did a fresh install of python 3.12.7.

@theChaosCoder
Copy link
Collaborator

theChaosCoder commented Nov 18, 2024

I know there were problems before for a pattern like -
I fixed it months ago with a simple replace("-", "_")

The errors could be leftovers from older vsrepo installations. Removing the problematic *.dist-info folders should fix it I hope :D

I can't reproduce the error, imwri and placebo are fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants