[Fixed] ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3 – Urllib3

by
Ali Hasan
llama-cpp-python openai-api urllib3

Quick Fix: urllib3 demands OpenSSL 1.1.1. Your environment’s ‘ssl’ module is compiled with LibreSSL 2.8.3, so:

  • Either install OpenSSL 1.1.1 with: brew install [email protected]
  • Or downgrade to a compatible urllib3 version: pip install urllib3==1.26.6

The Solutions:

Solution 3: Downgrade urllib3

The error message indicates that the ‘urllib3’ module version 2.0 only supports OpenSSL 1.1.1+, but your system has LibreSSL 2.8.3. To resolve this issue, you can downgrade ‘urllib3’ to an earlier version that supports LibreSSL. Here are the steps to downgrade ‘urllib3’ to version 1.26.16:

  1. Open your terminal or command prompt.
  2. Run the following command to downgrade ‘urllib3’:
    pip install urllib3==1.26.16
    
  3. This will install urllib3 version 1.26.16, which supports LibreSSL.
  4. After the installation is complete, restart your Python interpreter or IDE.
  5. Try importing OpenAI again. It should now work without the error.

Solution 4: Install an older version of urllib3

The error message indicates that the urllib3 module is not compatible with the installed version of OpenSSL. To resolve this issue, you can install an older version of urllib3 that is compatible with OpenSSL 1.1.1. To do this, use the following command:

pip install urllib3==1.26.6

Solution 5: Upgrade Python Version

urllib3 version 2.0 supports OpenSSL 1.1.1+ only, while your current Python installation uses LibreSSL 2.8.3. To resolve this issue, upgrade your Python version to a newer release that supports OpenSSL 1.1.1+ compatibility.

For instance, you can install Python 3.11 or a later version using a command such as:

pipenv install --python 3.11

This will create a virtual environment with Python 3.11, allowing you to run code that requires OpenSSL 1.1.1+ compatibility.

Q&A

How do I fix the error: ‘ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1 attualmente the ‘ssl’ module is\u2018 con Libre\u2019 2.8.3′?

Install an older version of urllib3 that is compatible with your OpenSSL version by using the command: pip install urllib3==1.26.6

I tried updating urllib3 but still get the error. What else can I do?

Force install an older version of urllib3 compatible with your OpenSSL version. Use this command: pip install –force-reinstall urllib3==1.26.6

I installed [email protected] but still get the error. What do I do?

Try installing an older version of urllib3 that is compatible with your OpenSSL version. Use this command: pip install urllib3==1.26.6

Video Explanation:

The following video, titled "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

This video provides further insights and detailed explanations related to the content discussed in the article.