# Getting "Import "web3" could not be resolved" error

**URL:** <https://forum.openzeppelin.com/t/getting-import-web3-could-not-be-resolved-error/16592>\
**Category:** Smart Contracts\
**Tags:** solidity\
**Created:** [October 6, 2021, 3:42pm UTC](https://forum.openzeppelin.com/t/getting-import-web3-could-not-be-resolved-error/16592 "2021-10-06T15:42:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalhaze01](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/digitalhaze01/32/9281_2.png) [@Digitalhaze01](https://forum.openzeppelin.com/u/Digitalhaze01)\
**Post date:** [October 6, 2021, 3:42pm UTC](https://forum.openzeppelin.com/t/getting-import-web3-could-not-be-resolved-error/16592/1 "2021-10-06T15:42:11Z")

</div>

```auto
from solcx import compile_standard, install_solc
from web3 import Web3
import json

install_solc("0.8.0")

with open("./SimpleStorage.sol", "r") as file:
    simple_storage_file = file.read()

# Compile our solidity

compiled_sol = compile_standard(
    {
        "language": "Solidity",
        "sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
        "settings": {
            "outputSelection": {
                "*": {"*": ["abi", "metadata", "evm.bytecode", "enm.sourceMap"]}
            }
        },
    },
    solc_version="0.8.0",
)

with open("compiled_code.json", "w") as file:
    json.dump(compiled_sol, file)

# get bytecode

bytecode = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["evm"][
    "bytecode"
]
["object"]

# get abi
abi = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["abi"]

# for connecting to ganache

w3 = Web3(Web3.HTTPProvider("http://0.0.0.0:7545"))
chain_id = 5777
my_address = "not fill here"
private_key = "not fill here"

# Create the contract in python
SimpleStorage = w3.eth.contract(abi=abi, bytecode=bytecode) 

```

I'm getting an error while importing web3 as "Import "web3" could not be resolved"  
I'm working in the venv and all package install with pip btw.  
How can I fix the problem?

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [October 7, 2021, 9:03am UTC](https://forum.openzeppelin.com/t/getting-import-web3-could-not-be-resolved-error/16592/2 "2021-10-07T09:03:24Z")

</div>

Sorry, I am not sure for your issue, it looks ok for me,  
And why do not you try to use a framework to test it? such as `Brownie`, I think it is more easier.
