debugging

I keep getting ModuleNotFoundError: No module named 'Crypto' but i have pycryptodome installed


I am using web3.py in my app, and things were working smoothly until I received this error.

Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from api import app
  File "C:\Users\Ty Cooper\Desktop\Coding\Projects\streamline\server\api\__init__.py", line 8, in <module>
    from web3 import Web3
  File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\web3\__init__.py", line 7, in <module>
    from eth_account import Account  # noqa: E402
  File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_account\__init__.py", line 1, in <module>
    from eth_account.account import Account  # noqa: F401
  File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_account\account.py", line 10, in <module>
    from eth_keyfile import (
  File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_keyfile\__init__.py", line 7, in <module>
    from eth_keyfile.keyfile import (  # noqa: F401
  File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_keyfile\keyfile.py", line 5, in <module>
    from Crypto import Random
ModuleNotFoundError: No module named 'Crypto'

I have looked online to install pycryptodome and I have tried that and it is installed, but for some reason this error persist to populate.


Solution

  • I have found the issue. It was a naming error! I went to the site packages in

    File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_keyfile\keyfile.py", line 5, in <module>
        from Crypto import Random
    

    and I just capitalize all of the folder names.