When I try to run app.py (Python 3.3, PyCrypto 2.6) my virtualenv keeps returning the error listed above. My import statement is just from Crypto.Cipher import AES
Maybe you should this: pycryptodome==3.6.1 add it to requirements.txt and install, which should eliminate the error report. it works for me!
I had the same problem on my Mac when installing with pip
. I then removed pycrypto
and installed it again with easy_install
, like this:
pip uninstall pycrypto
easy_install pycrypto
also as Luke commented: If you have trouble running these commands, be sure to run them as admin (sudo)
Hope this helps!
EDIT: As winklerr correctly notes above, pycrypto is no longer safe. Use pycryptodome instead, it is a drop-in replacement
It could be a problem of loading python modules installed via pip. Refer to this answer Can't load Python modules installed via pip from site-packages directory and try something like
python -m pip install pycrypto
This worked for me
pip install pycryptodome==3.4.3
I ran into this on Mac as well, and it seems to be related to having an unfortunately similarly named "crypto" module (not sure what that is for) installed alongside of pycrypto via pip.
The fix seems to be removing both crypto and pycrypto with pip:
sudo pip uninstall crypto
sudo pip uninstall pycrypto
and reinstalling pycrypto:
sudo pip install pycrypto
Now it works as expected when I do something like:
from Crypto.Cipher import AES
Worked for me (Ubuntu 17.10)
Removing venv and creating it again with python v3.6
pip3 install PyJWT
sudo apt-get install build-essential libgmp3-dev python3-dev
pip3 install cryptography
pip3 install pycryptodome
pip3 install pycryptodomex
Pycrypto is deprecated, had problems with it, used Pycryptodome