attributeerror: module lib has no attribute openssl_add_all_algorithms error main comes because of incompatibility of cryptography and pyopenssl package. In the version 39.0.0 of cryptography certain changes happen which became incompatible with pyopenssl package. This became root cause for this error. In this article we will explore how easily we can fix this error by simply downgrading and upgrading packages version. So lets start.
attributeerror: module lib has no attribute openssl_add_all_algorithms ( Solution ) –
The first thing we should try when we stuck in version incompatibility related error is to upgrade the impacted version. Also need to verify that is pip updated or not. If not then go for below command to update pip.
python -m pip install --upgrade pip
after this command lets move to the solution. But please make sure we follow the solution in order.
Solution 1 : Upgrading pyopenssl, cryptography packages to latest version –
Please run the below command to upgrade both the package simultaneously.
pip install -U pyopenssl cryptography
When we use pip install command and do not specifically mention the version name then the interpreter automatically assume latest version as target version. Please try once after this.
Solution 2 : Downgrading cryptography version –
If the first solution is not working for you then the next thing you should try to fix this error is to downgrade the cryptography version. Most the issues comes with the version of 39.0.0 then we will downgrade just previous stable version of cryptography. Here is the command to downgrade cryptography package version.
pip install cryptography==38.0.4
Solution 3 : Upgrading pyopenssl version –
If even after trying the second solution of downgrade cryptography, Still you are facing same issue then you should try to upgrade the pyopenssl module to version greater than 22.1.0. This will fix up the error.
Run the below command.
pip install pyOpenSSL==23.0.0
Here is the complete article on how you should approach any AttributeError.
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.