Smart Contract/Blockchain Development

Hello. I’m struggling to import libraries and having issues with the smart contract programming. Can someone who has expertise in this field comment to help me out?
Been trying for days but having no luck - your help will be much appreciated.
Thank you very much.
Best regards.

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

Hello. Thank you for the feedback. Below is my detailed query:

When i try to import web3, solcx, & dotenv, it gives me an error saying: Import “web3” could not be resolved Import “solcx” could not be resolved Import “dotenv” could not be resolved. I even tried copy pasting the full code to ensure there isn’t any error in the code, but i guess there’s something else out of the way. I tried what internet suggested me (such as installing Visual Studio Community 2022, VSBuild Tools 2022 with the C++ fearures, checking different Python interpreters available in VSCode, etc), but so far did not prove to be helpful.

When i do pip install web3, i get error :
"… C:\Users\ashvi\AppData\Local\Programs\Python\Python39\include\pyconfig.h(59): fatal error C1083: Cannot open include file: ‘io.h’: No such file or directory
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe’ failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lru-dict

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure."

And when i run the program code, the detailed Terminal Output appears as:

"Traceback (most recent call last):
File “c:/Users/ashvi/demos/web3_py_simple_storage/sam”, line 3, in
from web3 import Web3
ModuleNotFoundError: No module named ‘web3’ "

Code link: web3_py_simple_storage/deploy.py at main · PatrickAlphaC/web3_py_simple_storage · GitHub

Python version: I had Python 3.10, then upon someone’s recommendation, changed it to 3.9, and recently to 3.8.10.

Python Interpreter in VSCode: using the recommended one by VSCode, i.e. 3.8.10 64-bit.

So can someone please be kind enough to help me out here?
Thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.