Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fabfile.py not working: No module named Crypto

I was following this tutorial, and reached the section on using Fabric to deploy django projects. However when I run my fabfile.py I get this error. And here is my fabfile.py. For what i can deduce the Crypto library is missing, by I've tried pip install Crypto and still get the same error. Any suggestions? Thanks.

like image 579
ng150716 Avatar asked Mar 18 '14 00:03

ng150716


People also ask

How do I fix No module named Crypto?

The Python "ModuleNotFoundError: No module named 'Crypto'" occurs when we forget to install the pycryptodome module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install pycryptodome command.

How do I install PyCrypto?

PyCrypto is written and tested using Python version 2.1 through 3.3. Python 1.5. 2 is not supported. The modules are packaged using the Distutils, so you can simply run “python setup.py build” to build the package, and “python setup.py install” to install it.


1 Answers

It could be that when you installed it, it didn't compile all the necessary files. Try re-installing again. Make sure you see no errors, if you do you might be missing some development files/headers.

pip uninstall pycrypto
pip install pycrypto

You can just test it from the python shell:

python

Then:

>>> import Crypto

If you don't see any errors you are good.

If for some reason the module got compiled as crypto instead of Crypto on the Mac you can try:

>> import crypto
>> import sys
>> sys.modules['Crypto'] = crypto
like image 91
Rico Avatar answered Nov 09 '22 22:11

Rico