0

I can run python3 myfile.py on the MAC OS command line and it works fine, but inside the IDE, I get the following error. I have done the

pip uninstall pycrypto
pip install pycrypto

This has no effect inside the PyCharm IDE, but it does work with the command line.

Python is 3.7 inside and outside the IDE. The pycrypto is installed via the Preferences -> Project -> Project Interpreter. The version of pycrpto is 2.6.1.

What am I missing?

    /Users/denisputnam/git/kingslanding/venv/bin/python /Users/denisputnam/git/kingslanding/denisputnam-cryptography-overview-exercise/mysymmetricencryptiondecryption.py
Traceback (most recent call last):
  File "/Users/denisputnam/git/kingslanding/denisputnam-cryptography-overview-exercise/mysymmetricencryptiondecryption.py", line 4, in <module>
    from Crypto.Cipher import AES 
ModuleNotFoundError: No module named 'Crypto'

Process finished with exit code 1
DenisMP
  • 973
  • 2
  • 16
  • 31

2 Answers2

1

Look into the following troubleshooting page.

According to your console output, you need to run /Users/denisputnam/git/kingslanding/venv/bin/python /Users/denisputnam/git/kingslanding/denisputnam-cryptography-overview-exercise/mysymmetricencryptiondecryption.py from the system terminal and see if it works.

Sergey K.
  • 1,855
  • 9
  • 12
  • Thank you, Sergey. I modified the Project Interpreter environment to point to the main OS location of the anaconda python3 environment and now it works. – DenisMP Nov 06 '19 at 16:05
1

You should use pycryptodome.

See documentation here: pycryptodome docs

Since you installed other modules that might interfere (usually developers install crypto by mistake), you may need to uninstall all the irrelevant modules you have and then install pycryptodome.

See my answer to Another similar question with details on uninstalling and reinstalling properly:

pip uninstall crypto
pip uninstall pycryptodome
pip install pycryptodome
RaamEE
  • 3,017
  • 4
  • 33
  • 53