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

Error with 2.30.0, not seen with 2.29.0 #6437

Closed
pgjones opened this issue May 3, 2023 · 2 comments
Closed

Error with 2.30.0, not seen with 2.29.0 #6437

pgjones opened this issue May 3, 2023 · 2 comments

Comments

@pgjones
Copy link

pgjones commented May 3, 2023

Expected Result

No TypeError: HTTPResponse.__init__() got an unexpected keyword argument 'strict' when running pdm install (which uses requests).

Actual Result

PDM, version 2.5.3

$ pdm install -v
STATUS: Resolving packages from lockfile...
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
STATUS: Fetching hashes for resolved packages...
Synchronizing working set with lock file: 73 to add, 12 to update, 0 to remove

pdm.termui: Removing distribution pip
  ✖ Update pip 23.0 -> 22.2.2 failed
Traceback (most recent call last):
  File ".venv/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "venv/lib/python3.10/site-packages/pdm/core.py", line 255, in main
    return Core().main(args)
  File "venv/lib/python3.10/site-packages/pdm/core.py", line 193, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File ".venv/lib/python3.10/site-packages/pdm/core.py", line 188, in main
    self.handle(project, options)
  File ".venv/lib/python3.10/site-packages/pdm/core.py", line 154, in handle
    command.handle(project, options)
  File ".venv/lib/python3.10/site-packages/pdm/cli/commands/install.py", line 62, in handle
    actions.do_sync(
  File "venv/lib/python3.10/site-packages/pdm/cli/actions.py", line 214, in do_sync
    synchronizer.synchronize()
  File "venv/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 401, in synchronize
    handlers[kind](key, progress)
  File ".venv/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 271, in update_candidate
    self.manager.install(can)
  File ".venv/lib/python3.10/site-packages/pdm/installers/manager.py", line 33, in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
  File ".venv/lib/python3.10/site-packages/pdm/models/candidates.py", line 360, in build
    self.obtain(allow_all=False)
  File ".venv/lib/python3.10/site-packages/pdm/models/candidates.py", line 419, in obtain
    result = finder.download_and_unpack(self.link, build_dir, download_dir, hash_options)
  File ".venv/lib/python3.10/site-packages/unearth/finder.py", line 391, in download_and_unpack
    file = unpack_link(
  File ".venv/lib/python3.10/site-packages/unearth/preparer.py", line 300, in unpack_link
    resp = session.get(link.normalized, stream=True)
  File ".venv/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File ".venv/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File ".venv/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "venv/lib/python3.10/site-packages/cachecontrol/adapter.py", line 48, in send
    cached_response = self.controller.cached_request(request)
  File ".venv/lib/python3.10/site-packages/cachecontrol/controller.py", line 155, in cached_request
    resp = self.serializer.loads(request, cache_data, body_file)
  File ".venv/lib/python3.10/site-packages/cachecontrol/serialize.py", line 95, in loads
    return getattr(self, "_loads_v{}".format(ver))(request, data, body_file)
  File ".venv/lib/python3.10/site-packages/cachecontrol/serialize.py", line 190, in _loads_v4
    return self.prepare_response(request, cached, body_file)
  File ".venv/lib/python3.10/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'

System Information

$ python -m requests.help
{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "2.1.1"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "3.4"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.10.10"
  },
  "platform": {
    "release": "22.2.0",
    "system": "Darwin"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.30.0"
  },
  "system_ssl": {
    "version": "1010114f"
  },
  "urllib3": {
    "version": "1.26.12"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": false
}

I'm not sure if this is requests or one of the other libraries using requests incorrectly.

@vdwees
Copy link

vdwees commented May 3, 2023

seems related to this, its deprecated but the change is still breaking
urllib3/urllib3#2267

@nateprewitt
Copy link
Member

Hi @pgjones, this appears to be an incompatibility in cachecontrol with the new release of urllib3 2.0. strict is no longer a supported argument on the HTTPResponse class. For the time being you'll likely need to pin to an older version of urllib3 or work with the cachecontrol team to update their usage.

woodruffw added a commit to pypa/gh-action-pip-audit that referenced this issue May 3, 2023
woodruffw added a commit to pypa/gh-action-pip-audit that referenced this issue May 3, 2023
* requirements: constrain requests below 2.30

See psf/requests#6437.

Signed-off-by: William Woodruff <[email protected]>

* requirements: relax

Signed-off-by: William Woodruff <[email protected]>

---------

Signed-off-by: William Woodruff <[email protected]>
vlaci added a commit to onekey-sec/unblob-native that referenced this issue May 4, 2023
vlaci added a commit to onekey-sec/unblob-native that referenced this issue May 4, 2023
vlaci added a commit to onekey-sec/unblob-native that referenced this issue May 4, 2023
vlaci added a commit to onekey-sec/unblob-native that referenced this issue May 4, 2023
vlaci added a commit to onekey-sec/unblob-native that referenced this issue May 4, 2023
vlaci added a commit to onekey-sec/unblob-native that referenced this issue May 4, 2023
JannisNe added a commit to JannisNe/timewise that referenced this issue May 5, 2023
AnonymouX47 added a commit to AnonymouX47/term-image that referenced this issue May 6, 2023
AnonymouX47 added a commit to AnonymouX47/termvisage that referenced this issue May 6, 2023
AnonymouX47 added a commit to AnonymouX47/urwidgets that referenced this issue May 6, 2023
dragon-dxw added a commit to nationalarchives/ds-caselaw-pdf-conversion that referenced this issue May 18, 2023
Rereading psf/requests#6437 suggests
that the underlying issue might not be in poetry -- taking a
belt-and-braces approach and bringing everything up to speed whilst
pinning urllib3 to <2 to prevent the issue
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants