0

I am using Python 3.11.1., Mac OS 12.6.3. and VScode. I am trying to use a script that needs web3. I have tried to install it to my best ability and it seems to not be able to see the install.

After multiple tries the code still shows the squigly lines under the imports.

import os
import time
import csv
from import Web3
from web3.middleware import geth_poa_middleware
from keys import account, private_key, APIprovider, address, chainlink_address, abi, chainlink_abi

inside my code editor it show underlines for:

web3
web3.middleware

I have tried to install with a venv (virtual enviroment) and also without. the same result occurs.

I am expecting that pip will install web3 and the script will execute properly.

Here is the commands I have tried to install.

Create a virtual environment:

$ virtualenv -p python3 ~/.venv-py3

Activate your new virtual environment:

$ source ~/.venv-py3/bin/activate

With virtualenv active, make sure you have the latest packaging tools

$ pip install --upgrade pip setuptools

Now we can install web3.py...

$ pip install --upgrade web3

still not working and unline under web3.

Grismar
  • 27,561
  • 4
  • 31
  • 54
  • Welcome to Stack Overflow. To be clear, you use VS Code to run the program? Why do you expect VS Code to use, or know about, the virtual environment that you created? Did you take any specific steps, to tell it which Python to use? – Karl Knechtel Feb 17 '23 at 03:06
  • IMO, if the editor's squiggly lines are only the case, it can show such because of many reasons. try running your code (python script) in the virtual environment where you'd installed the packages. If the same error is thrown by the python interpreter, then the error will be legit. – Kiran Parajuli Feb 17 '23 at 03:07
  • Note that you spelled `Web3` with a capital, and `web3.middleware` without a capital - not likely your whole problem, but certainly not helping. – Grismar Feb 17 '23 at 03:07
  • I just tried using capital "W" insted of lowercase for install.. I tried pip and pip3. This made the squigly lines go away so I am thinking it will see the import modules now. – pencil_it_in Feb 17 '23 at 03:24
  • It doesn't throw the web3 module error anymore! but the code wont execute. I got some other issues. Thanks for the help. – pencil_it_in Feb 17 '23 at 03:35
  • I do use VSCode. I assume that running in this venv will be seen by my code editor. This appears before my prompt at this time - (.venv-py3). – pencil_it_in Feb 17 '23 at 03:37

0 Answers0