-1

This error appears every time I try importing requests and other libraries:

C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\python.exe C:\Users\Administrator\PycharmProjects\pythonProject11\main.py 
Traceback (most recent call last):
  File "C:\Users\Administrator\PycharmProjects\pythonProject11\main.py", line 1, in <module>
    import requests
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\__init__.py", line 42, in <module>
    "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.1.0h  27 Mar 2018'. See: https://github.com/urllib3/urllib3/issues/2168

I am new to coding and went to stackoverflow, but most solutions didn't work!

Marcelo Paco
  • 2,732
  • 4
  • 9
  • 26
  • You can download the 1.1.1 version of OpenSSL from here https://wiki.openssl.org/index.php/Binaries , but I'm wondering why you have a 32-bit version of Python. Virtually everyone today is running 64-bit Windows. – Tim Roberts Aug 25 '23 at 19:03
  • Did you try reading [the link on the last line of the error message](https://github.com/urllib3/urllib3/issues/2168)? Did you try [copying and pasting that line into a search engine](https://duckduckgo.com/?q=ImportError%3A+urllib3+v2.0+only+supports+OpenSSL+1.1.1%2B%2C+currently+the+%27ssl%27+module+is+compiled+with+%27OpenSSL+1.1.0h++27+Mar+2018%27.+See%3A+https%3A%2F%2Fgithub.com%2Furllib3%2Furllib3%2Fissues%2F2168)? "went to stackoverflow, but most solutions didn't work!" - this implies that *some* of them *did*, so there should not be a question any more. – Karl Knechtel Aug 25 '23 at 20:31
  • Solved it by changing my interpreter from python 3.7 to python 3.10, but I tried manually setting up openssl 1.1.1v but in the IDE the version is still the preloaded 1.1.1t – JUST DENIO Aug 25 '23 at 23:02

1 Answers1

1

The error indicates that the latest versions of urllib3 only support OpenSSL versions, 1.1.1+.Try this

pip uninstall urllib3
pip install urllib3==1.26.16

Release History
https://pypi.org/project/urllib3/1.26.16/#history

Sauron
  • 551
  • 2
  • 11
  • I still get the same error. However, when I inputted the first line in cmd it said that urllib was not installed xd. I went straight to the second line and it successfully installed it, but the error I get in PyCharm is still the same – JUST DENIO Aug 25 '23 at 19:27
  • Your 'ssl' module is compiled with 'OpenSSL 1.1.0h . lower version urllib3 - 1.26.16 may be able to supports that. The OpenSSL used by builtin 'ssl' (and thus by 'urllib3' and 'requests') is compiled into Python itself.So You need a newer Python build that was compiled with OpenSSL 1.1.1. Upgrade your python or work in python environment. – Sauron Aug 25 '23 at 20:14