The Coder
The Coder

Reputation: 93

ModuleNotFoundError: No module named 'cryptodomex'

I am getting this error:

Traceback (most recent call last):
  File "XXX", line 7, in <module>
    from crypt import AESCipher
  File "XXX", line 3, in <module>
    from cryptodomex import Random
ModuleNotFoundError: No module named 'cryptodomex'

Process finished with exit code 1

Here is my code:

from cryptodomex import Random
from cryptodomex.Cipher import AES

I have the cryptodomex package installed and are still getting this error. Any thoughts?

Upvotes: 1

Views: 2429

Answers (2)

Apoorv Gunjan Pathak
Apoorv Gunjan Pathak

Reputation: 65

You should install Cryptodome library by following command line:

pip install pycryptodome

OR

sudo apt install python3-pycrytodome

You should try installing pycryptodomex rather pycryptodome(without x) using the following command line:

pip install pycrotodomex

As,

pip install pycrotodome

command gives ModuleNotFoundError

Upvotes: 0

SuperStormer
SuperStormer

Reputation: 5417

The pycryptodomex pip package installs its modules under the Cryptodome namespace, without the x. Your imports should be:

from Cryptodome import Random
from Cryptodome.Cipher import AES

(The pycryptodome (without the x) pip package installs its modules under Crypto, as a drop-in replacement for the old pycrypto library)

Upvotes: 1

Related Questions