ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_'
Asked Answered
L

5

8

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 answers in the forum I have inserted the path 'C:\Users\andre\Anaconda3\envs\py37\Library\bin' in the environment variables on Windows OS. After that I had the following error:

Traceback (most recent call last):
  File "C:\Users\andre\Documents\NetBeansProjects\Aladin_demo\py\get_class.py", line 8, in <module>
    import gensim
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\gensim\__init__.py", line 5, in <module>
    from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils  # noqa:F401
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\gensim\parsing\__init__.py", line 4, in <module>
    from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2,  # noqa:F401
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\gensim\parsing\preprocessing.py", line 42, in <module>
    from gensim import utils
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\gensim\utils.py", line 45, in <module>
    from smart_open import open
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\smart_open\__init__.py", line 28, in <module>
    from .smart_open_lib import open, smart_open, register_compressor
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\smart_open\smart_open_lib.py", line 40, in <module>
    import boto3
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\boto3\__init__.py", line 16, in <module>
    from boto3.session import Session
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\boto3\session.py", line 17, in <module>
    import botocore.session
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\session.py", line 30, in <module>
    import botocore.credentials
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\credentials.py", line 34, in <module>
    from botocore.config import Config
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\config.py", line 16, in <module>
    from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\endpoint.py", line 22, in <module>
    from botocore.awsrequest import create_request_object
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\awsrequest.py", line 26, in <module>
    import botocore.utils
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\utils.py", line 31, in <module>
    import botocore.httpsession
  File "C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\botocore\httpsession.py", line 7, in <module>
    from urllib3.util.ssl_ import (
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_' (C:\Users\andre\Anaconda3\envs\py37\lib\site-packages\urllib3\util\ssl_.py)

When I run my script in my Jupyter Notebook I don't see this error message, but when I run it on the command line I get the error above.

Larainelarboard answered 24/10, 2019 at 15:31 Comment(0)
L
0

I solved it by changing the version of python.

From python 3.7 to python 3.6

Larainelarboard answered 3/11, 2019 at 11:25 Comment(0)
N
3

If you get this on google colab, just restart the runtime.

Neilson answered 9/6, 2022 at 5:37 Comment(0)
L
0

I solved it by changing the version of python.

From python 3.7 to python 3.6

Larainelarboard answered 3/11, 2019 at 11:25 Comment(0)
A
0

I re-installed the same version of Python (3.7.7). I had previously changed my OpenSSL version and Python needed to re-install the one it liked.

Autry answered 15/5, 2020 at 22:34 Comment(0)
D
0

I solved it by copying below files

From anaconda3\Library\bin copy below files and paste them in anaconda3/DLLs

-   libcrypto-1_1-x64.dll
-   libssl-1_1-x64.dll
Dwinnell answered 15/5, 2023 at 11:22 Comment(0)
C
-1

On windows PowerShell, ensure you are running the virtual environment with Admin priveleges. That's what solved it for me.

Clarhe answered 26/9, 2023 at 20:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.