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

Dependency using deprecated url3 attribute causes PDM build to fail #1878

Closed
1 task done
KingMichaelPark opened this issue May 3, 2023 · 6 comments
Closed
1 task done
Labels
🐛 bug Something isn't working

Comments

@KingMichaelPark
Copy link
Contributor

KingMichaelPark commented May 3, 2023

  • 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

  1. Install PDM
  2. Run PDM build
mkdir example
cd example
python -m venv .venv
source .venv/bin/activate
python -m pip install pdm
python -m pdm build

Actual behavior

❯ python -m pdm build
Building sdist...
Inside an active virtualenv /home/mike/Projects/work/oxford/example/.venv, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
See /tmp/pdm-build-qha0udye.log for detailed debug log.
[TypeError]: HTTPResponse.__init__() got an unexpected keyword argument 'strict'
Add '-v' to see the detailed traceback

Expected behavior

Build was succeeding an hour ago but the bump to requests 2.30
is what is causing this
as cachecontrol makes reference to a deprecated .strict method
psf/cachecontrol#292

Environment Information

PDM version:
  2.5.3
Python Interpreter:
  /home/mike/example/.venv/bin/python (3.11)
Project Root:
  /home/mike/example
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.11.1",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.2.0-20-generic",
  "platform_system": "Linux",
  "platform_version": "#20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  6 07:48:48 UTC 2023",
  "python_full_version": "3.11.1",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "linux"
}

@KingMichaelPark KingMichaelPark added the 🐛 bug Something isn't working label May 3, 2023
@lambda
Copy link

lambda commented May 3, 2023

Full traceback:

[brcampbell@beta-0535 py-beta-gitlab]$ pipx run --spec pdm==2.5.3 pdm sync -vv
⚠️  pdm is already on your PATH and installed at /home/brcampbell/.local/bin/pdm. Downloading and running anyway.
WARNING: The following problems are found in your project:
  project-config: python.path config needs to be moved to .pdm-python and .pdm.toml needs to be renamed to pdm.toml
Run pdm fix to fix all or pdm fix <name> to fix individual problem.
STATUS: Resolving packages from lockfile...
STATUS: Fetching hashes for resolved packages...
pdm.termui: Running PEP 517 backend to get metadata for <Link file:///home/brcampbell/src/py-beta-gitlab (from None)>
pdm.termui: Preparing isolated env for PEP 517 build...
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   pdm-pep517
pdm.termui:   python>=3.10.11,<3.10.12
pdm.termui:   Adding requirement pdm-pep517
unearth.collector: Collecting links from https://gitlab.beta.team/api/v4/projects/beta%2Fpypi/packages/pypi/simple/pdm-pep517/
unearth.auth: Found index url https://gitlab.beta.team/api/v4/projects/beta%2Fpypi/packages/pypi/simple
unearth.auth: Found index url https://gitlab.beta.team/api/v4/projects/beta%2Fpypi/packages/pypi/simple
unearth.auth: Found credentials in netrc for gitlab.beta.team
Traceback (most recent call last):
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/core.py", line 255, in main
    return Core().main(args)
           ^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/core.py", line 193, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/core.py", line 188, in main
    self.handle(project, options)
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/core.py", line 154, in handle
    command.handle(project, options)
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/cli/commands/sync.py", line 43, in handle
    actions.do_sync(
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/cli/actions.py", line 214, in do_sync
    synchronizer.synchronize()
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/installers/synchronizers.py", line 353, in synchronize
    to_add, to_update, to_remove = self.compare_with_working_set()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/installers/synchronizers.py", line 215, in compare_with_working_set
    candidates = self.candidates.copy()
                 ^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/installers/synchronizers.py", line 148, in candidates
    if self.should_install_editables():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/installers/synchronizers.py", line 166, in should_install_editables
    metadata = self.self_candidate.prepare(self.environment).metadata
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/installers/synchronizers.py", line 136, in self_candidate
    return self.environment.project.make_self_candidate(not self.no_editable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/project/core.py", line 519, in make_self_candidate
    can.prepare(self.environment).metadata
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/models/candidates.py", line 498, in metadata
    result = self.prepare_metadata()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/models/candidates.py", line 481, in prepare_metadata
    self._metadata_dir = builder(self._unpacked_dir, self.environment).prepare_metadata(metadir_parent)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/builders/editable.py", line 21, in prepare_metadata
    self.install(self._requires, shared=True)
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/builders/base.py", line 294, in install
    install_requirements(missing, env)
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/installers/core.py", line 28, in install_requirements
    resolved, _ = resolve(
                  ^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/resolver/core.py", line 35, in resolve
    result = resolver.resolve(requirements, max_rounds)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/resolvelib/resolvers.py", line 173, in _add_to_criteria
    if not criterion.candidates:
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/resolvelib/structs.py", line 127, in __bool__
    next(iter(self))
         ^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/resolvelib/structs.py", line 136, in __iter__
    self._factory() if self._iterable is None else self._iterable
    ^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/resolver/providers.py", line 139, in matches_gen
    candidates = self._find_candidates(reqs[0])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/resolver/providers.py", line 123, in _find_candidates
    return self.repository.find_candidates(requirement, requirement.prerelease or self.allow_prereleases)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/models/repositories.py", line 148, in find_candidates
    cans = LazySequence(self._find_candidates(requirement))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/pdm/models/repositories.py", line 323, in _find_candidates
    for c in finder.find_all_packages(requirement.project_name, allow_yanked=requirement.is_pinned)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/unearth/finder.py", line 281, in find_all_packages
    return LazySequence(self._find_packages(package_name, allow_yanked, hashes))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/unearth/finder.py", line 263, in _find_packages
    return sorted(all_packages, key=self._sort_key, reverse=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/unearth/collector.py", line 133, in collect_links_from_location
    yield from _collect_links_from_index(session, location)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/unearth/collector.py", line 153, in _collect_links_from_index
    page = fetch_page(session, location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/unearth/collector.py", line 140, in fetch_page
    resp = _get_html_response(session, location)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/unearth/collector.py", line 175, in _get_html_response
    resp = session.get(
           ^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/requests/sessions.py", line 723, in send
    history = [resp for resp in gen]
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/requests/sessions.py", line 723, in <listcomp>
    history = [resp for resp in gen]
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/requests/sessions.py", line 266, in resolve_redirects
    resp = self.send(
           ^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/cachecontrol/adapter.py", line 55, in send
    request.headers.update(self.controller.conditional_headers(request))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/cachecontrol/controller.py", line 244, in conditional_headers
    resp = self.serializer.loads(request, self.cache.get(cache_url))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/cachecontrol/serialize.py", line 95, in loads
    return getattr(self, "_loads_v{}".format(ver))(request, data, body_file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/cachecontrol/serialize.py", line 190, in _loads_v4
    return self.prepare_response(request, cached, body_file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brcampbell/.local/pipx/.cache/6261c6b273d6d16/lib64/python3.11/site-packages/cachecontrol/serialize.py", line 141, in prepare_response
    return HTTPResponse(body=body, preload_content=False, **cached["response"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HTTPResponse.__init__() got an unexpected keyword argument 'strict'

@lambda
Copy link

lambda commented May 3, 2023

This can be fixed by pinning older dependencies in your PDM install environment. I pinned to requests 2.29.0 because that was the update that happened today that triggered the issue, but it looks like pinning urllib3 to 1.26.15 also works to work around the issue.

@frostming
Copy link
Collaborator

The 2.30 version has been yanked, this should be fixed automatically.

@KingMichaelPark
Copy link
Contributor Author

It was yanked for a different reason @frostming

@frostming
Copy link
Collaborator

It was yanked for a different reason @frostming

Right, it is an issue of cachecontrol using the deprecated arguments. I will try contacting the maintainer since it seems he has been inactive for a period of time.

@KingMichaelPark
Copy link
Contributor Author

KingMichaelPark commented May 4, 2023

No worries, I may have come across as demanding with the tone of the last message, I just wanted to let you know. Thanks!

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

3 participants