Issues with Pip install and import

Hi Everyone,

I’m learning to code with python and have windows 10 installed with python v3.9.4. I’m trying to install ‘web3’ to build smart contract interactions but am having an issue at the first hurdle lol! I managed to install python without any issue using it’s default settings. The user path variable points to the install and script directory fine.

Issue i’m having is that when try to ‘pip install web3’ it gives the following error:

###################################################
PS C:\Users\user> pip install web3
Collecting web3
Using cached web3-5.18.0-py3-none-any.whl (469 kB)
Collecting protobuf<4,>=3.10.0
Using cached protobuf-3.15.8-py2.py3-none-any.whl (173 kB)
Collecting requests<3.0.0,>=2.16.0
Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)
Collecting eth-account<0.6.0,>=0.5.3
Using cached eth_account-0.5.4-py3-none-any.whl (94 kB)
Collecting eth-utils<2.0.0,>=1.9.5
Using cached eth_utils-1.10.0-py3-none-any.whl (24 kB)
Collecting eth-typing<3.0.0,>=2.0.0
Using cached eth_typing-2.2.2-py3-none-any.whl (6.2 kB)
Collecting eth-abi<3.0.0,>=2.0.0b6
Using cached eth_abi-2.1.1-py3-none-any.whl (27 kB)
Collecting lru-dict<2.0.0,>=1.1.6
Using cached lru-dict-1.1.7.tar.gz (10 kB)
Collecting eth-hash[pycryptodome]<1.0.0,>=0.2.0
Using cached eth_hash-0.3.1-py3-none-any.whl (8.9 kB)
Requirement already satisfied: pywin32>=223; platform_system == “Windows” in c:\users\user\appdata\roaming\python\python39\site-packages (from web3) (300)
Collecting websockets<9.0.0,>=8.1.0
Using cached websockets-8.1.tar.gz (58 kB)
Collecting jsonschema<4.0.0,>=3.2.0
Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Collecting hexbytes<1.0.0,>=0.1.0
Using cached hexbytes-0.2.1-py3-none-any.whl (6.0 kB)
Collecting ipfshttpclient==0.7.0a1
Using cached ipfshttpclient-0.7.0a1-py3-none-any.whl (231 kB)
Collecting six>=1.9
Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
Collecting idna<3,>=2.5
Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting chardet<5,>=3.0.2
Using cached chardet-4.0.0-py2.py3-none-any.whl (178 kB)
Collecting eth-keys!=0.3.2,<0.4.0,>=0.2.1
Using cached eth_keys-0.3.3-py3-none-any.whl (20 kB)
Collecting eth-rlp<2,>=0.1.2
Using cached eth_rlp-0.2.1-py3-none-any.whl (5.0 kB)
Collecting eth-keyfile<0.6.0,>=0.5.0
Using cached eth_keyfile-0.5.1-py3-none-any.whl (8.3 kB)
Collecting bitarray<1.3.0,>=1.2.1
Using cached bitarray-1.2.2.tar.gz (48 kB)
Collecting rlp<3,>=1.0.0
Using cached rlp-2.0.1-py2.py3-none-any.whl (20 kB)
Collecting cytoolz<1.0.0,>=0.10.1; implementation_name == “cpython”
Using cached cytoolz-0.11.0.tar.gz (477 kB)
Collecting parsimonious<0.9.0,>=0.8.0
Using cached parsimonious-0.8.1.tar.gz (45 kB)
Collecting pycryptodome<4,>=3.6.6; extra == “pycryptodome”
Using cached pycryptodome-3.10.1-cp35-abi3-win_amd64.whl (1.6 MB)
Collecting pyrsistent>=0.14.0
Using cached pyrsistent-0.17.3.tar.gz (106 kB)
Requirement already satisfied: setuptools in c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from jsonschema<4.0.0,>=3.2.0->web3) (49.2.1)
Collecting attrs>=17.4.0
Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting multiaddr>=0.0.7
Using cached multiaddr-0.0.9-py2.py3-none-any.whl (16 kB)
Collecting toolz>=0.8.0
Using cached toolz-0.11.1-py3-none-any.whl (55 kB)
Collecting base58
Using cached base58-2.1.0-py3-none-any.whl (5.6 kB)
Collecting varint
Using cached varint-1.0.2.tar.gz (1.9 kB)
Collecting netaddr
Using cached netaddr-0.8.0-py2.py3-none-any.whl (1.9 MB)
Using legacy ‘setup.py install’ for lru-dict, since package ‘wheel’ is not installed.
Using legacy ‘setup.py install’ for websockets, since package ‘wheel’ is not installed.
Using legacy ‘setup.py install’ for bitarray, since package ‘wheel’ is not installed.
Using legacy ‘setup.py install’ for cytoolz, since package ‘wheel’ is not installed.
Using legacy ‘setup.py install’ for parsimonious, since package ‘wheel’ is not installed.
Using legacy ‘setup.py install’ for pyrsistent, since package ‘wheel’ is not installed.
Using legacy ‘setup.py install’ for varint, since package ‘wheel’ is not installed.
Installing collected packages: six, protobuf, urllib3, certifi, idna, chardet, requests, eth-typing, parsimonious, pycryptodome, eth-hash, toolz, cytoolz, eth-utils, eth-abi, eth-keys, hexbytes, rlp, eth-rlp, eth-keyfile, bitarray, eth-account, lru-dict, websockets, pyrsistent, attrs, jsonschema, base58, varint, netaddr, multiaddr, ipfshttpclient, web3
Running setup.py install for parsimonious … done
Running setup.py install for cytoolz … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\user\appdata\local\programs\python\python39\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\user\AppData\Local\Temp\pip-install-8rebu8ab\cytoolz\setup.py’"’"’; file=’"’"‘C:\Users\user\AppData\Local\Temp\pip-install-8rebu8ab\cytoolz\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record ‘C:\Users\user\AppData\Local\Temp\pip-record-d9hgt71z\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘c:\users\user\appdata\local\programs\python\python39\Include\cytoolz’
cwd: C:\Users\user\AppData\Local\Temp\pip-install-8rebu8ab\cytoolz
Complete output (50 lines):
ALERT: Cython not installed. Building without Cython.
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\cytoolz
copying cytoolz\compatibility.py → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\utils_test.py → build\lib.win-amd64-3.9\cytoolz
copying cytoolz_signatures.py → build\lib.win-amd64-3.9\cytoolz
copying cytoolz_version.py → build\lib.win-amd64-3.9\cytoolz
copying cytoolz_init_.py → build\lib.win-amd64-3.9\cytoolz
creating build\lib.win-amd64-3.9\cytoolz\curried
copying cytoolz\curried\exceptions.py → build\lib.win-amd64-3.9\cytoolz\curried
copying cytoolz\curried\operator.py → build\lib.win-amd64-3.9\cytoolz\curried
copying cytoolz\curried_init_.py → build\lib.win-amd64-3.9\cytoolz\curried
copying cytoolz\dicttoolz.pyx → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\functoolz.pyx → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\itertoolz.pyx → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\recipes.pyx → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\utils.pyx → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\cpython.pxd → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\dicttoolz.pxd → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\functoolz.pxd → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\itertoolz.pxd → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\recipes.pxd → build\lib.win-amd64-3.9\cytoolz
copying cytoolz\utils.pxd → build\lib.win-amd64-3.9\cytoolz
copying cytoolz_init_.pxd → build\lib.win-amd64-3.9\cytoolz
creating build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\dev_skip_test.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_compatibility.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_curried.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_curried_toolzlike.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_dev_skip_test.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_dicttoolz.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_docstrings.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_doctests.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_embedded_sigs.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_functoolz.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_inspect_args.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_itertoolz.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_none_safe.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_recipes.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_serialization.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_signatures.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_tlz.py → build\lib.win-amd64-3.9\cytoolz\tests
copying cytoolz\tests\test_utils.py → build\lib.win-amd64-3.9\cytoolz\tests
running build_ext
building ‘cytoolz.dicttoolz’ extension
error: Microsoft Visual C++ 14.0 is required. Get it with “Build Tools for Visual Studio”: Download Visual Studio 2019 for Windows & Mac
----------------------------------------
ERROR: Command errored out with exit status 1: ‘c:\users\user\appdata\local\programs\python\python39\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\user\AppData\Local\Temp\pip-install-8rebu8ab\cytoolz\setup.py’"’"’; file=’"’"‘C:\Users\user\AppData\Local\Temp\pip-install-8rebu8ab\cytoolz\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record ‘C:\Users\user\AppData\Local\Temp\pip-record-d9hgt71z\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘c:\users\user\appdata\local\programs\python\python39\Include\cytoolz’ Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 21.1 is available.
You should consider upgrading via the ‘c:\users\user\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip’ command.
PS C:\Users\user>

###################################################

I’ve confirmed that there is an issue but trying to import web3 but it tells me web3 doesn’t exist:

from web3 import Web3

Traceback (most recent call last):
File “e:\Python\Web3 TEST\Web3 Connection Test.py”, line 1, in
from web3 import Web3
ModuleNotFoundError: No module named ‘web3’

#####################################################

Sorry for the noobish question! I guess there are some packages that are conflicting but not sure how to resolve it

Thanks!
Sunny

According to the error log, you must need to install Cython and Microsoft Visual C++ 14.0.

That should get it done.

3 Likes

Thanks Sanket! I wasn’t sure why it was asking that but yep installing “Build Tools for Visual Studio” with C++ tools has resolved the issue and “pip install web3” works perfectly now… Thanks!

1 Like