Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't update Python's OpenSSL

For one of my projects I need a newest version of SSL certificate.

Thats's what I have:

python3 --version

Python 3.8.6

openssl version

OpenSSL 1.1.1f  31 Mar 2020

python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'

OpenSSL 1.0.2g  1 Mar 2016

python3 -m OpenSSL.debug

pyOpenSSL: 21.0.0
cryptography: 35.0.0
cffi: 1.14.4
cryptography's compiled against OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
cryptography's linked OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
Python's OpenSSL: OpenSSL 1.0.2g  1 Mar 2016
Python executable: /usr/bin/python3
Python version: 3.8.6 (default, Oct  6 2020, 04:02:53)
[GCC 5.4.0 20160609]
Platform: linux
sys.path: ['/opt/programs', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/local/lib/python3.8/dist-packages/pip-21.0.1-py3.8.egg', '/usr/lib/python3/dist-packages']

I think that's the problem

Python's OpenSSL: OpenSSL 1.0.2g  1 Mar 2016

So I creating a new virtual env and pyOpenSSL and checking the SSL again

python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'

OpenSSL 1.0.2g  1 Mar 2016

python3 -m OpenSSL.debug

pyOpenSSL: 21.0.0
cryptography: 35.0.0
cffi: 1.14.6
cryptography's compiled against OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
cryptography's linked OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
Python's OpenSSL: OpenSSL 1.0.2g  1 Mar 2016
Python executable: /opt/parsers/env4/bin/python3
Python version: 3.8.6 (default, Oct  6 2020, 04:02:53)
[GCC 5.4.0 20160609]
Platform: linux
sys.path: ['/opt/programs', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/parsers/env4/lib/python3.8/site-packages']

And I see the same problem: Python's OpenSSL: OpenSSL 1.0.2g 1 Mar 2016

How I can update Python's OpenSSL ?

like image 282
sky_glider Avatar asked Sep 09 '26 12:09

sky_glider


1 Answers

I couldn't wait for an answer. And still haven't solved the Python update issue.

But I found a solution for my project.

I installed a new version of Python (3.9.7) locally and created a new virtual environment in my project using it.

Then I checked the Python's SSL certificate using a new venv:

python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'

OpenSSL 1.1.1f 31 Mar 2020

And that's what I needed

Then I installed all the dependencies in a new venv. I renamed the old venv from "env" to "env2" and left it for now just in case. I renamed the new venv to "env" and activated it.

This is how my project started working.

like image 75
sky_glider Avatar answered Sep 12 '26 02:09

sky_glider