question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import name 'PROTOCOL_TLS' from 'urllib3.util.ssl_'

See original GitHub issue

Describe the bug

This issue is a direct follow-up from https://github.com/boto/botocore/issues/2562

When using older versions of urllib3 (often vendored), importing botocore.utils (or using botocore in any consideration) will fail.

Steps to reproduce

$ pip install --upgrade botocore==1.23.26
$ pip install --upgrade urllib3==1.22.0
$ python
>>> import botocore.utils
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/matthieu/.virtualenvs/reproavm/lib/python3.8/site-packages/botocore/utils.py", line 32, in <module>
    import botocore.httpsession
  File "/Users/matthieu/.virtualenvs/reproavm/lib/python3.8/site-packages/botocore/httpsession.py", line 10, in <module>
    from urllib3.util.ssl_ import (
ImportError: cannot import name 'PROTOCOL_TLS' from 'urllib3.util.ssl_' (/Users/matthieu/.virtualenvs/reproavm/lib/python3.8/site-packages/urllib3/util/ssl_.py)

Expected behavior

botocore should fallback to importing PROTOCOL_TLS from ssl.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
dmitryivashkincommented, Sep 12, 2022

Still reproducible on python 3.8.13: botocore 1.27.70 urllib3 1.26.12

3reactions
drigolicommented, Dec 24, 2021

Hi @stobrien89, I see this issue too.

awscli==1.22.26 botocore==1.23.26 urllib3==1.26.7

Statement on lines 10-12 in httpsession.py wants to import PROTOCOL_TLS from urllib3.util.ssl_, which does not exist there.

I can workaround by removing it from that statement and adding a separate statement, pulling from ssl. Though, I suspect the strategic direction is to level up on TLS version which would require more planning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

from urllib3.util.ssl_ import ( ImportError: cannot import name ssl
I have an automation solution built in python. The solution can be run from both cmd or pycharm of course. 2 options to...
Read more >
Importerror cannot import name ssl from urllib3 util ssl_ : Fix
importerror cannot import name ssl from urllib3 util ssl_ error comes because of an incompatible version of python with urllib3 module.
Read more >
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_'
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_'. Views: 12,209. I was running an old script for one of my client today.
Read more >
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_'
I'm trying to start a python code from cmd. I use python 3.7 and Anaconda. I initially had a DLL problem. Following some...
Read more >
cannot import name 'ssl' from 'urllib3.util.ssl_' - CodeAntenna
import gensim引起的 https://stackoverflow.com/questions/58544638/importerror-cannot-import-name-ssl-from-urllib3-util-ssl 这个网页提出降版本的方法,我试了 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found