missing module with cryptography.hazmat
See original GitHub issueNuitka seems to compile my project fine, but it fails at runtime with this error:
Traceback (most recent call last):
File "/.../demo_crypt/main.py", line 1, in <module>
from cryptography.hazmat.primitives.kdf.scrypt import Scrypt
File "/.../demo_crypt/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py", line 14, in <module cryptography.hazmat.primitives.kdf.scrypt>
from cryptography.hazmat.primitives import constant_time
File "/.../demo_crypt/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/constant_time.py", line 11, in <module cryptography.hazmat.primitives.constant_time>
from cryptography.hazmat.bindings._constant_time import lib
ModuleNotFoundError: No module named 'cryptography.hazmat.bindings._constant_time'
Here are the commands to reproduce it:
- Make a virtualenv:
python3.7 -m venv demo_crypt/venv
cd demo_crypt
pip install wheel cryptography
pip install -U "https://github.com/Nuitka/Nuitka/archive/develop.zip"
- Create a main.py that contains:
from cryptography.hazmat.primitives.kdf.scrypt import Scrypt
from cryptography.hazmat.backends import default_backend
def scrypt(passphrase, salt, scrypt_n=1<<12, scrypt_r=12, scrypt_p=1):
kdf = Scrypt(salt, length=32, n=scrypt_n, r=scrypt_r, p=scrypt_p, backend=default_backend())
return kdf.derive(passphrase)
print(scrypt(b"junk", b"sea"))
- Run
python main.py
to ensure that there are no errors. python -m nuitka --follow-imports -j 10 --plugin-enable=pylint-warnings main.py
./main.bin
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13 (4 by maintainers)
Top Results From Across the Web
ImportError: No module named cryptography.hazmat.bindings ...
I was able to fix that by reinstalling pyOpenSSL and cryptography. But now the following error is being raised. ImportError: No module named ......
Read more >tfm_ipc: No module named 'cryptography.hazmat.primitives ...
In my case, the cryptography Python module is installed in the virtual environment I am using for Zephyr, and not in the "global"...
Read more >[Fixed] ModuleNotFoundError: No module named 'cryptography'
How to Fix “ModuleNotFoundError: No module named 'cryptography'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >No module named 'cryptography.hazmat.bindings._openssl'
Summary: net-p2p/deluge-2.0. 3-r8: Python 3.9 error: No module named 'cryptography. hazm... Add an attachment (proposed patch, testcase, etc.)
Read more >Symmetric encryption — Cryptography 39.0.0.dev1 ...
This is a “Hazardous Materials” module. ... GCM provides no guarantees of ciphertext integrity until decryption is complete. GCM (Galois Counter Mode) is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like I’m having some similar issue:
I’ve got this trying to run my app after compilation.
I’ve checked nuitka/plugins/standard/ImplicitImports.py and it includes:
Any thoughts?
Closing this, to me the issue is failed, because I don’t have a reproducer, I don’t know what parts are fixed, please open new issues with full description. The things posted here are probably all different ones, but it’s unclear how relevant they are now.