vcrpy: vcrpy throws an error if latest urllib3 is installed

vcrpy won’t import with latest urllib.

root@ef153dd6180d:/# python --version
Python 3.11.3
root@ef153dd6180d:/# pip install urllib3 vcrpy
Collecting urllib3
  Downloading urllib3-2.0.0-py3-none-any.whl (123 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 123.2/123.2 kB 10.0 MB/s eta 0:00:00
Collecting vcrpy
  Downloading vcrpy-4.2.1-py2.py3-none-any.whl (40 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 kB 45.4 MB/s eta 0:00:00
Collecting PyYAML
  Downloading PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (757 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 757.9/757.9 kB 51.1 MB/s eta 0:00:00
Collecting wrapt
  Downloading wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.9/78.9 kB 80.8 MB/s eta 0:00:00
Collecting six>=1.5
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting yarl
  Downloading yarl-1.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (282 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 282.8/282.8 kB 161.6 MB/s eta 0:00:00
Collecting multidict>=4.0
  Downloading multidict-6.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (117 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.4/117.4 kB 136.7 MB/s eta 0:00:00
Collecting idna>=2.0
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 82.9 MB/s eta 0:00:00
Installing collected packages: wrapt, urllib3, six, PyYAML, multidict, idna, yarl, vcrpy
Successfully installed PyYAML-6.0 idna-3.4 multidict-6.0.4 six-1.16.0 urllib3-2.0.0 vcrpy-4.2.1 wrapt-1.15.0 yarl-1.9.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
root@ef153dd6180d:/# python
Python 3.11.3 (main, Apr 12 2023, 14:31:14) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vcr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/site-packages/vcr/__init__.py", line 2, in <module>
    from .config import VCR
  File "/usr/local/lib/python3.11/site-packages/vcr/config.py", line 11, in <module>
    from .cassette import Cassette
  File "/usr/local/lib/python3.11/site-packages/vcr/cassette.py", line 12, in <module>
    from .patch import CassettePatcherBuilder
  File "/usr/local/lib/python3.11/site-packages/vcr/patch.py", line 41, in <module>
    _VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'urllib3.connectionpool' has no attribute 'VerifiedHTTPSConnection'

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 14
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

VerifiedHTTPSConnection is still here in urllib3 2.0. We stopped importing it from connectionpool.py but it still defined in connection.py. The vcrpy import was only working by accident here: this was always documented to be in urllib3.connection.

You can use from urllib3.connection import VerifiedHTTPSConnection instead but at this point I think it would be better to use the new name with from urllib3.connection import HTTPSConnection.

And it of course is possible by upgrading urllib3 after vcrpy is installed.

@fiendish I only considered combinations that would pass pip3 check, true.

Also, thank you both for the fair consideration. I do appreciate the responses.

New ticket specifically about urllib3 v2 with Python ❤️.10 makes sense to me

@kevin1024 can this issue stay open until the python<3.10 problem is worked out?