pythonvisual-studio-codecryptographypycryptopycryptodome

Import "Crypto.Cipher" could not be resolved Pylance (reportMissingImports) in VSCode intel MAC


I've pip installed the ones that i need as I viewed the documentation and other websites. How come it still says that my module is not found?

Here are my imports

import socket
import random
import hashlib

from Crypto.Cipher import ARC4

#from Crypto.Cipher import AES

#from Crypto.Hash import SHA256, HMAC
#from Crypto.Random import get_random_bytes

here is my pip list on vs code. My terminal also already has all of these

Package                   Version
------------------------- ---------
certifi                   2023.7.22
cffi                      1.15.1
charset-normalizer        3.2.0
crypto                    1.4.1
cryptography              41.0.3
idna                      3.4
Naked                     0.1.32
pip                       23.2.1
pycparser                 2.21
pycryptodome              3.18.0
pycryptodome-test-vectors 1.0.12
pycryptodomex             3.18.0
PyYAML                    6.0.1
requests                  2.31.0
setuptools                68.0.0
shellescape               3.8.1
urllib3                   2.0.4

this is the error reflected in the vscode terminal

 File "/Users/bbbb/Downloads/alice.py", line 5, in <module>
    from Crypto.Cipher import ARC4
ModuleNotFoundError: No module named 'Crypto'

I tried pip installing everything i needed from seeing other stack overflow questions. I've restarted my vscode many times too. nothing seemed to work


Solution

  • Omg guys. if yall have this problem. I resolved it by playing around in my environment.

    Simply press command+shift+p. Select python:select interpreter. select the global one. if it doesnt work, try the others one by one!

    Mine finally worked... after 2 days... yays!