Fix WebAuthn Installation cryptography.openssl.x509 Error on Ubuntu 20.04
Problem
When installing or using webauthn
with Odoo, you may encounter the following error:
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.x509'
This is typically due to incompatible versions of cryptography
, urllib3
, or pyOpenSSL
.
Check Installed Versions
Run the following command to check the installed versions:
pip list | grep -E 'cryptography|urllib3|pyOpenSSL'
Example output:
cryptography 45.0.2
pyOpenSSL 25.1.0
urllib3 1.26.5
Note:
urllib3
is outdated in this example.
Fix Instructions
Step 1: log into container
docker exec -it -u root <odoo_container> /bin/bash
Step 2: Upgrade urllib3
pip install --upgrade urllib3
Verify the upgrade:
pip show urllib3
You should see:
Name: urllib3
Version: 2.4.0
Step 4: Recheck versions
pip list | grep -E 'cryptography|urllib3|pyOpenSSL'
Expected output:
cryptography 45.0.2
pyOpenSSL 25.1.0
urllib3 2.4.0
Restart your Odoo server and the error should be resolved.
Summary
Package | Required Version |
---|---|
cryptography | ≥ 45.0.0 |
pyOpenSSL | ≥ 25.1.0 |
urllib3 | ≥ 2.0.0 |
Make sure all dependencies are compatible and up-to-date.
Reply