2

I keep getting an import error saying:

ModuleNotFoundError: No module named 'Crypto'

I have gone over various other answers about how to resolve this, but it does not mention how I can resolve the issue in PyCharm.

I originally tried to pip3 install pycrpyto in the Pycharm terminal, but it would not install. Then I hear about pycryptodome and was able to install it properly. However, when I type import Crypto , it keeps saying that the module was not found. How is this issue resolved in Pycharm.

lionheart
  • 333
  • 2
  • 11
  • You likely installed the package for a different Python installation than the one which PyCharm is set to use. Are you using virtual environments? – AMC Apr 04 '20 at 00:34
  • 1
    I am using virtual environments. But I installed it in the PyCharm terminal where it said (venv) so I thought it would be installed for the project. How can I install it for the virtual env – lionheart Apr 04 '20 at 00:38
  • Can you try installing it through the Project Interpreter settings? – AMC Apr 04 '20 at 00:49

3 Answers3

2
  • Go to settings-->project:project_name-->Project Interpreter
  • now you can see plus(+) symbol beside project,version,latest version (table), click on that
  • a new tab will appear, type the package you want to install and click on install package which is at the left bottom of that tab

Note: check if it is capital c or small c, the packages are case sensitive

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
goutham m
  • 44
  • 2
1

Go to: Pycharm>File>Settings>Python Interpreter> click +

Search for the package: Crypto or cryptography

and click install.

If the install fails with the SSL error: Could not fetch URL https://pypi.org/simple/crypto-mediator/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/crypto-mediator/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping

Go back to the same page and after selecting the package click on the checkbox Options and mention: --trusted-host pypi.org --trusted-host files.pythonhosted.org and then install the package

Arvind NK
  • 21
  • 2
0

I think you have to install the package pycrypto.

MLD
  • 1
  • is there anything wrong with the other answer that says install the crypto (other than not saying `pycrypto`) - if so please update the answer with your answer. – Mr R Mar 24 '21 at 23:01