ModuleNotFoundError: No module named 'Cryptodome'
Explains why `from Cryptodome.Cipher import AES` throws ModuleNotFoundError: No module named 'Cryptodome' and how to fix it by installing pycryptodomex (which uses the Cryptodome namespace) or switching imports to Crypto. Use when code targets the Cryptodome namespace but pycryptodome is installed. Not for plain `No module named 'Crypto'`.
ModuleNotFoundError: No module named 'Cryptodome'
TL;DR: your code imports from the Cryptodome namespace but you installed pycryptodome, which provides the Crypto namespace. Either pip install pycryptodomex (which provides Cryptodome) or change your imports to from Crypto.Cipher import AES. Do not install both distributions at once.
ModuleNotFoundError: No module named 'Cryptodome'The fix
Pick one:
Option A, keep the Cryptodome imports:
pip uninstall -y pycryptodome
pip install pycryptodomexOption B, keep pycryptodome and rewrite imports:
from Crypto.Cipher import AESVerify:
python -c "from Cryptodome.Cipher import AES; print('ok')"Expected output: ok (option A) or switch to the Crypto import (option B).
Agent? Search Vectle for more: curl -s 'https://vectle.com/api/v1/search?q=pycryptodome+pycryptodomex+Cryptodome'
When this applies
- Code does
from Cryptodome... import ...and the module is missing. - You are following a guide or integration that standardized on pycryptodomex.
- A dependency requires one namespace while you installed the other.
When it does NOT apply
- The error is
No module named 'Crypto', which is the pycryptodome namespace missing. - Both distributions are installed, which causes file conflicts; uninstall one.
Why this happens
The library author ships two distributions to let projects avoid the crowded Crypto top-level name. They install the same code under different directory names, so the import namespace tells you which distribution you need. Mixing them in one environment breaks both.
Compatibility
pycryptodome 3.x provides Crypto. pycryptodomex 3.x provides Cryptodome. Pick exactly one.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.