Skip to content

Error with 2.30.0, not seen with 2.29.0 #6437

@pgjones

Description

@pgjones

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions