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

ImportError: cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_' #2562

Closed
barrykan opened this issue Nov 8, 2021 · 13 comments
Closed
Labels
bug This issue is a confirmed bug.

Comments

@barrykan
Copy link

barrykan commented Nov 8, 2021

Describe the bug
The just released version 1.23.0 will spit out the error in the title if you try to import botocore.utils, which precludes almost any use of the library.

Steps to reproduce
My environment:
OS: macOS Big Sur (11.4)
Python: 3.7.12 (virtualenv ultimately from brew installed version)
pyOpenSSL: 20.0.0

Install botocore 1.23.0 with pip3 install botocore==1.23.0. Run import botocore.utils.

Expected behavior
There should not be an import error (and I believe this is the first version where this happens as it doesn't in 1.22.12).

Debug logs
(I cannot set the debug logger without getting the import error, so I can only show the import error.)

In [1]: import botocore.utils
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-918253be0bba> in <module>
----> 1 import botocore.utils

~/docs/venv/barrypy3/lib/python3.7/site-packages/botocore/utils.py in <module>
     30 import botocore
     31 import botocore.awsrequest
---> 32 import botocore.httpsession
     33 from botocore.compat import (
     34     json, quote, zip_longest, urlsplit, urlunsplit, OrderedDict,

~/docs/venv/barrypy3/lib/python3.7/site-packages/botocore/httpsession.py in <module>
      8 from urllib3 import PoolManager, proxy_from_url, Timeout
      9 from urllib3.util.retry import Retry
---> 10 from urllib3.util.ssl_ import (
     11     ssl, OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION, OP_NO_TICKET,
     12     PROTOCOL_TLS, PROTOCOL_TLS_CLIENT, DEFAULT_CIPHERS,

ImportError: cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_' (/Users/barry/docs/venv/barrypy3/lib/python3.7/site-packages/urllib3/util/ssl_.py)
@barrykan barrykan added the needs-triage This issue or PR still needs to be triaged. label Nov 8, 2021
@nateprewitt nateprewitt added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Nov 8, 2021
@nateprewitt
Copy link
Contributor

Hi @barrykan, thanks for opening this issue. It looks like we may have a gap in the imports for users on old versions of urllib3. Can you please provide the urllib3 version you're using locally?

For immediate mitigation while we investigate, we'd recommend making sure you're on urllib3 >= 1.26 or pinning to botocore < 1.23.

@nateprewitt nateprewitt added bug This issue is a confirmed bug. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 8, 2021
@rjmackay
Copy link

rjmackay commented Nov 8, 2021

I'm seeing this too. I have urllib3 1.25.8

@jturner
Copy link

jturner commented Nov 8, 2021

Seeing this as well on Python 3.8 and urllib3 1.25.11

@cristianoperez
Copy link

Same problem here

@barrykan
Copy link
Author

barrykan commented Nov 8, 2021

Hi @barrykan, thanks for opening this issue. It looks like we may have a gap in the imports for users on old versions of urllib3. Can you please provide the urllib3 version you're using locally?

For immediate mitigation while we investigate, we'd recommend making sure you're on urllib3 >= 1.26 or pinning to botocore < 1.23.

Hi @nateprewitt , thank you for your quick reply. My urllib3 version is 1.25.11.

@cristianoperez
Copy link

Im changed the ‎urllib3 to 1.26.7 and it worked

@nateprewitt nateprewitt removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Nov 8, 2021
@octane-typerandom
Copy link

We are seeing this issue as well.

@Lokiiiiii
Copy link

+1

1 similar comment
@ben-thwaites
Copy link

+1

@cameron-mar
Copy link

Hey all, I've found that our requests library was installing an old version of urllib3 (1.25.8). When urllib3 was being used in our AWS Lambda, it was calling that old version of urllib3 instead of the one installed with boto3 (1.26.7). Not sure if this helps anyone else wondering the version installed by boto3 wasn't being used.

@nateprewitt
Copy link
Contributor

Botocore 1.23.1 has been released with fix for this. Please let us know if you're still experiencing issues.

@stobrien89
Copy link

Closing for now, but please let us know if this is still an issue!

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

westphahl pushed a commit to westphahl/nodepool that referenced this issue May 26, 2023
boto3 1.20.0 depends on botocore 1.23.0 which depends on
urllib3>=1.26.0. Unfortunately they don't record that properly in their
setup.cfg which allows them to install using urllib3 1.25.11 which is
valid in our old requirements. This then fails at runtime due to an
invalid import:

  boto/botocore#2562

Fix this by bumping up urllib3 then bump boto3 to match.

Change-Id: I941c252f9a3bb07eca2c52b18a5f2d609394e0c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

10 participants