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

vcrpy throws an error if latest urllib3 is installed #688

Closed
scotloach opened this issue Apr 28, 2023 · 15 comments · Fixed by vertexproject/synapse#3119 or #699
Closed

vcrpy throws an error if latest urllib3 is installed #688

scotloach opened this issue Apr 28, 2023 · 15 comments · Fixed by vertexproject/synapse#3119 or #699

Comments

@scotloach
Copy link

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'

@pquentin
Copy link

pquentin commented May 3, 2023

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.

agateau-gg added a commit to GitGuardian/ggshield that referenced this issue May 4, 2023
vcrpy does not use urllib3 correctly. Pin urllib3 until
kevin1024/vcrpy#688 is fixed.
agateau-gg added a commit to GitGuardian/py-gitguardian that referenced this issue May 4, 2023
vcrpy does not use urllib3 correctly. Pin urllib3 until
kevin1024/vcrpy#688 is fixed.
lavigne958 added a commit to burnash/gspread that referenced this issue May 4, 2023
@saisankargochhayat
Copy link

Related: urllib3/urllib3#3017

@alisakr
Copy link

alisakr commented May 4, 2023

I'm having the same issue, the issue appears to be that VERIFIEDHTTPSConnection is imported from connectionpool in vcr. But that is not where its declared but rather a place in urllib3 that used to import VERIFIEDHTTPSConnection as well.

scop added a commit to scop/pytekukko that referenced this issue May 4, 2023
scop added a commit to scop/pytekukko that referenced this issue May 4, 2023
bakert added a commit to PennyDreadfulMTG/Penny-Dreadful-Tools that referenced this issue May 5, 2023
agateau-gg added a commit to GitGuardian/ggshield that referenced this issue May 5, 2023
vcrpy does not use urllib3 correctly. Pin urllib3 until
kevin1024/vcrpy#688 is fixed.

Needed a hack in the "Install dependencies" step to work around a build
failure on Windows: for some reason the Windows builder still had urllib
2.0.2 installed. Could not reproduce this in my Windows VM so I suspect
there is a bug in the way the setup-python GitHub action works.
agateau-gg added a commit to GitGuardian/ggshield that referenced this issue May 5, 2023
vcrpy does not use urllib3 correctly. Pin urllib3 until
kevin1024/vcrpy#688 is fixed.

Needed a hack in the "Install dependencies" step to work around a build
failure on Windows: for some reason the Windows builder still had urllib
2.0.2 installed. Could not reproduce this in my Windows VM so I suspect
there is a bug in the way the setup-python GitHub action works.
vzhd1701 added a commit to vzhd1701/enex2notion that referenced this issue May 6, 2023
ttuffin added a commit to ansible/ansible-rulebook that referenced this issue May 8, 2023
Tests are currently failing due to kevin1024/vcrpy#688.
This PR temporarily pins the urllib3 version to <2 until there is a new release
of vcrpy.
TheChymera added a commit to TheChymera/gentoo that referenced this issue May 23, 2023
Upstream issue: kevin1024/vcrpy#688

Signed-off-by: Horea Christian <chr@chymera.eu>
MattBlissett added a commit to gbif/pygbif that referenced this issue May 24, 2023
pmav99 added a commit to pmav99/searvey that referenced this issue May 25, 2023
This shouldn't affect the wheel metadata, so we can make a new release without issue.
hartwork pushed a commit that referenced this issue May 25, 2023
Since urllib3 v2 the re-export of connection.HTTPConnection in
urllib3.connectionpool was removed.

In this commit we use urllib3.connection where needed. Some references
to connectionpool.HTTPConnection are still there for backward
compatibility.

Closes #688
pmav99 added a commit to oceanmodeling/searvey that referenced this issue May 26, 2023
This shouldn't affect the wheel metadata, so we can make a new release without issue.
kevin1024 pushed a commit that referenced this issue May 26, 2023
Since urllib3 v2 the re-export of connection.HTTPConnection in
urllib3.connectionpool was removed.

In this commit we use urllib3.connection where needed. Some references
to connectionpool.HTTPConnection are still there for backward
compatibility.

Closes #688
Samoed added a commit to Samoed/EthicsAnalysis that referenced this issue May 26, 2023
amosjyng added a commit to amosjyng/vcr-langchain that referenced this issue May 30, 2023
@fiendish
Copy link

fiendish commented Jun 9, 2023

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

@hartwork
Copy link
Collaborator

hartwork commented Jun 9, 2023

@fiendish release >=4.3.1 has no issue because since commit 69db5c9 urllib3 v2 cannot even be installed at the same time for Python <3.10. So far my vote against a re-open. Could you elaborate how a re-open would help you?

@hartwork
Copy link
Collaborator

hartwork commented Jun 9, 2023

@fiendish PS: We welcome help allowing support for Python <3.10 with urllib3 v2 installed if you have ideas how. Comment #699 (comment) and after document how far we got economically in more detail.

@fiendish
Copy link

fiendish commented Jun 9, 2023

@hartwork It's a procedural request, not a technical one. people reference this issue when discussing the problem with their builds, and the problem isn't fixed for urllib3v2 + py3.9. I've had requests already asking why particular urllib updates are blocked because the issue looks resolved until you go to the release notes.

We welcome help allowing support for Python <3.10 with urllib3 v2 installed if you have ideas how

At the time I don't. I wish I did.

@hartwork
Copy link
Collaborator

hartwork commented Jun 9, 2023

Hi @fiendish I'm in a bit of a conflict here, maybe you can help me with that, let me explain. Issue "vcrpy throws an error if latest urllib3 is installed" is impossible to happen for both the latest release and Git master so in literal sense and development sense the ticket being closed as fixed is correct, with the current title.
What you're asking for is some open ticket "Please support urllib3 v2 with Python <3.10". Since I am not aware of plans of anyone to do more work on that subject, I personally neither want to transform this closed ticket here into being that open ticket nor create a new dedicated ticket: I don't feel it's a good representation of reality. I would ask you: If you need an open ticket "Please support urllib3 v2 with Python <3.10", please create a new ticket with a sentence or two which other project needs this combination to work in reality. From what I understood it could help your case and it would help my conflict. What do you think?

@jairhenrique @kevin1024 please be invited to join in with your view on this, I have no intentions to misrepresent my view on this as the view of the whole team if it's not.

@kevin1024
Copy link
Owner

New ticket specifically about urllib3 v2 with Python <3.10 makes sense to me

@fiendish
Copy link

fiendish commented Jun 9, 2023

Issue "vcrpy throws an error if latest urllib3 is installed" is impossible to happen

I think this depends on what one means by "latest" and "impossible". urllib3<2 is of course not the latest urllib3. And it of course is possible by upgrading urllib3 after vcrpy is installed. Though the problem does not manifest at import time.

But I recognize your dilemma and can just continue pointing people to the reason given outside of this github issue.

@fiendish
Copy link

fiendish commented Jun 9, 2023

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

@hartwork
Copy link
Collaborator

hartwork commented Jun 9, 2023

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment