Tetoros21Bill
Tetoros21Bill

Reputation: 11

Visual studio code (Import "Crypto.Util.number" could not be resolved) when i try to run some code for cryptohack

I wanted to start solving puzzles and stuff on cryptohack because one of my university classes requires it and i want to use the python library pycryptodome but even after installing it i get the error :Import "Crypto.Util.number" could not be resolved.

i've tried a few time to uninstall and reinstall the library but it doesn't seem to fix it and whenever i try to do 'pip3 install --upgrade pycrypto' i get these errors at the bottom

" note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycrypto Running setup.py clean for pycrypto Failed to build pycrypto"

any recommendations for fixing it will be greatly appreciated

Upvotes: 0

Views: 2009

Answers (2)

John Hanley
John Hanley

Reputation: 81454

Uninstall pycrypto and pycryptodome. Try to uninstall both so that these two conflicting packages are removed.

pip uninstall pycrypto
pip uninstall pycryptodome

Then install pycryptodome.

pip install pycryptodome

Upvotes: 0

fkri06
fkri06

Reputation: 46

  1. Create a fresh folder for your project and open up this folder in vscode. Here PYCRYPT_CODE is my project folder in vscode. I'm using Python 3.9 and pip 20.

new fresh vscode project

  1. On your terminal, create virtual environment for this project, then activate the virtual environment.

To create virtual environment

python -m venv venv

To activate virtual environment

python ./venv/bin/activate

Create and activate virtual environment

  1. use pip install pycryptodome to install the pycryptodome package. Now you can use the number module from utility package.

enter image description here

enter image description here

Upvotes: 0

Related Questions