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

Cannot run v2.20.0 on Python 3.8 #3241

Closed
1 task done
woopla opened this issue Oct 31, 2024 · 13 comments
Closed
1 task done

Cannot run v2.20.0 on Python 3.8 #3241

woopla opened this issue Oct 31, 2024 · 13 comments
Labels
🐛 bug Something isn't working

Comments

@woopla
Copy link

woopla commented Oct 31, 2024

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

$ python3.8 -m pip install --user --upgrade pdm
$ cd <PDM-managed project>
$ ~/.local/bin/pdm use <path to python3.8>
INFO: Using the last selection, add '-i' to ignore it.
Virtualenv is created successfully at /mnt/ci-data/E-KYqTyq/0/big/git-builds-webapp/client/.venv
Using Python interpreter: /mnt/ci-data/E-KYqTyq/0/big/git-builds-webapp/client/.venv/bin/python (3.8)
$ ~/.local/bin/pdm install -v
WARNING: Lockfile is generated on an older version of PDM
WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated
Updating the lock file...
DEPRECATED: `cross_platform` strategy is deprecated in favor of the new lock targets.
See docs: http://pdm-project.org/en/latest/usage/lock-targets/
Traceback (most recent call last):
  File "/home/calgit/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/core.py", line 378, in main
    return core.main(args or sys.argv[1:])
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/core.py", line 267, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/core.py", line 262, in main
    self.handle(project, options)
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/core.py", line 194, in handle
    command.handle(project, options)
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/cli/commands/install.py", line 95, in handle
    actions.do_lock(
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/cli/actions.py", line 122, in do_lock
    resolver = resolver_class(
  File "<string>", line 13, in __init__
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/resolver/resolvelib.py", line 30, in __post_init__
    provider = self.project.get_provider(
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/project/core.py", line 552, in get_provider
    from pdm.resolver.providers import get_provider
  File "/home/calgit/.local/lib/python3.8/site-packages/pdm/resolver/providers.py", line 49, in <module>
    class BaseProvider(AbstractProvider[Requirement, Candidate, str]):
TypeError: 'type' object is not subscriptable

Actual behavior

Python complains about a part of the code that was changed as part of #3235

Expected behavior

PDM installs the package

Environment Information

$ ~/.local/bin/pdm info
PDM version:
  2.20.0
Python Interpreter:
  /mnt/ci-data/E-KYqTyq/0/big/git-builds-webapp/client/.venv/bin/python (3.8)
Project Root:
  /mnt/ci-data/E-KYqTyq/0/big/git-builds-webapp/client
Local Packages:
  
$ ~/.local/bin/pdm info --env
{
  "implementation_name": "cpython",
  "implementation_version": "3.8.7",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "4.18.0-305.el8.x86_64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Thu Apr 29 08:54:30 EDT 2021",
  "python_full_version": "3.8.7",
  "platform_python_implementation": "CPython",
  "python_version": "3.8",
  "sys_platform": "linux"
}
@alexanderepstein
Copy link

Essentially the same error on 3.11

    class BaseProvider(AbstractProvider[Requirement, Candidate, str]):
                       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type 'AbstractProvider' is not subscriptable

@woopla
Copy link
Author

woopla commented Oct 31, 2024

@frostming I see #3239 now, but shouldn't the dependencies for PDM be updated to reflect that? When I update PDM I've got this:

Requirement already satisfied: resolvelib>=1.0.1 in ./.local/lib/python3.8/site-packages (from pdm) (1.0.1)

@jvllmr
Copy link

jvllmr commented Oct 31, 2024

Same on Python 3.12:

pdm.termui: Error occurs
Traceback (most recent call last):
  File "/home/jan/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/termui.py", line 260, in logging
    yield logger
  File "/home/jan/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/cli/actions.py", line 122, in do_lock
    resolver = resolver_class(
               ^^^^^^^^^^^^^^^
  File "<string>", line 13, in __init__
  File "/home/jan/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/resolver/resolvelib.py", line 30, in __post_init__
    provider = self.project.get_provider(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jan/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/project/core.py", line 552, in get_provider
    from pdm.resolver.providers import get_provider
  File "/home/jan/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/resolver/providers.py", line 49, in <module>
    class BaseProvider(AbstractProvider[Requirement, Candidate, str]):
                       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type 'AbstractProvider' is not subscriptable

@notatallshaw
Copy link

I don't know PDM at all, but for those getting the error TypeError: type 'AbstractProvider' is not subscriptable can you try upgrading to resolvelib 1.1.0 and see if you still get it?

@woopla
Copy link
Author

woopla commented Oct 31, 2024

That resolves it @notatallshaw but the PDM dependencies need to be fixed in the package.

@jvllmr
Copy link

jvllmr commented Oct 31, 2024

I had no plugins installed so pipx uninstall pdm and then pipx install pdm fixed the issue for me. I assume it's because resolvelib did not get updated when running pipx upgrade-all

@notatallshaw
Copy link

notatallshaw commented Oct 31, 2024

That resolves it @notatallshaw but the PDM dependencies need to be fixed in the package.

Yeah, I would also reccomend that @frostming yank's the 2.20.0 release (and either replaces it with 2.20.0post1 or 2.20.1) as, from my experience, releases with bad metadata in them tend to cause a very long tail of problems.

@alexanderepstein
Copy link

@notatallshaw However my original issue #3240 showed up without updating PDM because PDM versions pre 2.20.0 pinned resolvelib as resolvelib>=1.0.1. The changes introduced in 1.1 for resolvelib seem to be breaking and should have been a major not minor release.

@notatallshaw
Copy link

notatallshaw commented Oct 31, 2024

@notatallshaw However my original issue #3240 showed up without updating PDM because PDM versions pre 2.20.0 pinned resolvelib as resolvelib>=1.0.1. The changes introduced in 1.1 for resolvelib seem to be breaking and should have been a major not minor release.

I'm not excluding that there might need to be a resolvelib release also, if a bug or unexpected breaking change is identified.

But major/minor release breakage is only defined for intentional behavior, if PDM was relying on unintentional behavior and it's non-trivial to fix in resolvelib, then it may just have to stand that the solution for users is to pin resolvelib and/or update PDM.

Even if it is found that resolvelib broke behavior that was intentional and it yanked 1.1.0 and replaced it with 2.0.0 that won't help users who are upgrading as PDM's requirement is resolvelib>=1.0.1

It also might be worth suggesting that PDM vendors resolvelib in the same way that pip does, it comes with it's own drawbacks, but it definitely prevents accidental breakage.

@alexanderepstein
Copy link

Agreed, that's a fair point about semantic versioning relying on intentional defined behavior. I can't say I really know how pdm is using resolvelib so hard for me to say if its intentional or undefined behavior.

Good point on the >= requirement, thats unfortunate that PDM didn't specify <2.0.0.

@notatallshaw
Copy link

Yeah, likely we'll need to wait for @frostming to be able to work on this, they are an expert on both the resolvelib and PDM side, and may be able to think of a quick fix for both libraries.

@iamthebot
Copy link

Strongly recommend yanking this release since even in a clean environment we end up pulling a resolvelib that causes this issue.

@frostming
Copy link
Collaborator

post1 released, and yank the old version

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

No branches or pull requests

6 participants