Hello. I feel like the biggest idiot. I've been working with python for some time now and have never had any problems installing packages via pip or from a folder. Also pip list shows me that web3 is installed in the above-mentioned version. Unfortunately, as described in the documentation, I can't import the package directly via python, jupyter notebooks or spyder. I hope you can help me. I would like to send sensor data to a Smartcontract for my master thesis and fail already at the first step. Somewhere I read that Virtual Studio 2015 or the C++ Builder might be the reason. I already fixed this one.
The code which produced the error
from web3.auto import w3
The full output of the error
runfile('C:/Users/FabianKramer/Documents/ETH/untitled1.py', wdir='C:/Users/FabianKramer/Documents/ETH')
Traceback (most recent call last):
File "
runfile('C:/Users/FabianKramer/Documents/ETH/untitled1.py', wdir='C:/Users/FabianKramer/Documents/ETH')
File "C:UsersFabianKramerAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "C:UsersFabianKramerAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/FabianKramer/Documents/ETH/untitled1.py", line 1, in
from web3.auto import w3
ModuleNotFoundError: No module named 'web3'
?
Can you answer a few more questions.
pip freeze what kind of output do you get?web3 library.@pipermerriam
When you run pip freeze what kind of output do you get?
It looks like pip list. Here again, web3 version 3.16.5 is displayed.
Are you installing in a global python interpreter or a virtual environment (you should almost definitely be using a virtual environment)
I don't know exactly what you mean by that. I tried to use the console, Spyder and also Jupyter notebooks. When I started with Python I installed python as a single program. For a project I installed Anaconda later on. Here the current version conda 4.3.30 is available.
How did you install the web3 library.
I used pip install web3. Additionally I tried to install web3 via the archive which is offered in the Github directory. Only "Requirement already satisfied:" was shown here. Also no other components have been installed through -upgrades.
Can you run pip uninstall web3 and then pip install web3 and provide the full output of both of those commands.
C:\Users\FabianKramer>pip uninstall web3
Uninstalling web3-3.16.5:
c:\python363\lib\site-packages\web3-3.16.5.dist-info\description.rst
c:\python363\lib\site-packages\web3-3.16.5.dist-info\installer
c:\python363\lib\site-packages\web3-3.16.5.dist-info\metadata
c:\python363\lib\site-packages\web3-3.16.5.dist-info\metadata.json
c:\python363\lib\site-packages\web3-3.16.5.dist-info\record
c:\python363\lib\site-packages\web3-3.16.5.dist-info\top_level.txt
c:\python363\lib\site-packages\web3-3.16.5.dist-info\wheel
c:\python363\lib\site-packages\web3\__init__.py
c:\python363\lib\site-packages\web3\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\admin.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\contract.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\db.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\eth.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\exceptions.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\iban.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\main.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\manager.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\miner.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\module.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\net.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\personal.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\shh.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\testing.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\txpool.cpython-36.pyc
c:\python363\lib\site-packages\web3\__pycache__\version.cpython-36.pyc
c:\python363\lib\site-packages\web3\admin.py
c:\python363\lib\site-packages\web3\contract.py
c:\python363\lib\site-packages\web3\db.py
c:\python363\lib\site-packages\web3\eth.py
c:\python363\lib\site-packages\web3\exceptions.py
c:\python363\lib\site-packages\web3\iban.py
c:\python363\lib\site-packages\web3\main.py
c:\python363\lib\site-packages\web3\manager.py
c:\python363\lib\site-packages\web3\middleware\__init__.py
c:\python363\lib\site-packages\web3\middleware\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\__pycache__\attrdict.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\__pycache__\exception_handling.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\__pycache__\fixture.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\__pycache__\formatting.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\__pycache__\pythonic.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\__pycache__\stalecheck.cpython-36.pyc
c:\python363\lib\site-packages\web3\middleware\attrdict.py
c:\python363\lib\site-packages\web3\middleware\exception_handling.py
c:\python363\lib\site-packages\web3\middleware\fixture.py
c:\python363\lib\site-packages\web3\middleware\formatting.py
c:\python363\lib\site-packages\web3\middleware\pythonic.py
c:\python363\lib\site-packages\web3\middleware\stalecheck.py
c:\python363\lib\site-packages\web3\miner.py
c:\python363\lib\site-packages\web3\module.py
c:\python363\lib\site-packages\web3\net.py
c:\python363\lib\site-packages\web3\personal.py
c:\python363\lib\site-packages\web3\providers\__init__.py
c:\python363\lib\site-packages\web3\providers\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\__pycache__\base.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\__pycache__\ipc.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\__pycache__\rpc.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\__pycache__\tester.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\base.py
c:\python363\lib\site-packages\web3\providers\eth_tester\__init__.py
c:\python363\lib\site-packages\web3\providers\eth_tester\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\eth_tester\__pycache__\main.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\eth_tester\__pycache__\middleware.cpython-36.pyc
c:\python363\lib\site-packages\web3\providers\eth_tester\main.py
c:\python363\lib\site-packages\web3\providers\eth_tester\middleware.py
c:\python363\lib\site-packages\web3\providers\ipc.py
c:\python363\lib\site-packages\web3\providers\rpc.py
c:\python363\lib\site-packages\web3\providers\tester.py
c:\python363\lib\site-packages\web3\shh.py
c:\python363\lib\site-packages\web3\testing.py
c:\python363\lib\site-packages\web3\txpool.py
c:\python363\lib\site-packages\web3\utils\__init__.py
c:\python363\lib\site-packages\web3\utils\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\abi.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\blocks.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\caching.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\datastructures.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\decorators.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\empty.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\encoding.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\events.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\exception.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\exception_py3.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\filters.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\formatters.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\http.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\normalizers.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\signing.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\transactions.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\validation.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\__pycache__\windows.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\abi.py
c:\python363\lib\site-packages\web3\utils\blocks.py
c:\python363\lib\site-packages\web3\utils\caching.py
c:\python363\lib\site-packages\web3\utils\compat\__init__.py
c:\python363\lib\site-packages\web3\utils\compat\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\compat\__pycache__\compat_gevent.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\compat\__pycache__\compat_py2.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\compat\__pycache__\compat_py3.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\compat\__pycache__\compat_requests.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\compat\__pycache__\compat_stdlib.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\compat\compat_gevent.py
c:\python363\lib\site-packages\web3\utils\compat\compat_py2.py
c:\python363\lib\site-packages\web3\utils\compat\compat_py3.py
c:\python363\lib\site-packages\web3\utils\compat\compat_requests.py
c:\python363\lib\site-packages\web3\utils\compat\compat_stdlib.py
c:\python363\lib\site-packages\web3\utils\datastructures.py
c:\python363\lib\site-packages\web3\utils\decorators.py
c:\python363\lib\site-packages\web3\utils\empty.py
c:\python363\lib\site-packages\web3\utils\encoding.py
c:\python363\lib\site-packages\web3\utils\events.py
c:\python363\lib\site-packages\web3\utils\exception.py
c:\python363\lib\site-packages\web3\utils\exception_py2.py
c:\python363\lib\site-packages\web3\utils\exception_py3.py
c:\python363\lib\site-packages\web3\utils\filters.py
c:\python363\lib\site-packages\web3\utils\formatters.py
c:\python363\lib\site-packages\web3\utils\http.py
c:\python363\lib\site-packages\web3\utils\module_testing\__init__.py
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\emitter_contract.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\eth_module.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\math_contract.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\net_module.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\personal_module.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\version_module.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\__pycache__\web3_module.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\module_testing\emitter_contract.py
c:\python363\lib\site-packages\web3\utils\module_testing\eth_module.py
c:\python363\lib\site-packages\web3\utils\module_testing\math_contract.py
c:\python363\lib\site-packages\web3\utils\module_testing\net_module.py
c:\python363\lib\site-packages\web3\utils\module_testing\personal_module.py
c:\python363\lib\site-packages\web3\utils\module_testing\version_module.py
c:\python363\lib\site-packages\web3\utils\module_testing\web3_module.py
c:\python363\lib\site-packages\web3\utils\normalizers.py
c:\python363\lib\site-packages\web3\utils\signing.py
c:\python363\lib\site-packages\web3\utils\six\__init__.py
c:\python363\lib\site-packages\web3\utils\six\__pycache__\__init__.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\six\__pycache__\six_py2.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\six\__pycache__\six_py3.cpython-36.pyc
c:\python363\lib\site-packages\web3\utils\six\six_py2.py
c:\python363\lib\site-packages\web3\utils\six\six_py3.py
c:\python363\lib\site-packages\web3\utils\transactions.py
c:\python363\lib\site-packages\web3\utils\validation.py
c:\python363\lib\site-packages\web3\utils\windows.py
c:\python363\lib\site-packages\web3\version.py
Proceed (y/n)? y
Successfully uninstalled web3-3.16.5
C:\Users\FabianKramer>pip install web3
Collecting web3
Using cached web3-3.16.5-py3-none-any.whl
Requirement already satisfied: cytoolz>=0.8.2 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: pysha3>=0.3 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: lru-dict>=1.1.6 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: requests>=2.12.4 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: rlp>=0.4.7 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: toolz>=0.8.2 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: eth-tester==0.1.0b11 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: eth-abi<0.6.0,>=0.5.0 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: eth-utils<1.0.0,>=0.7.1 in c:\python363\lib\site-packages (from web3)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python363\lib\site-packages (from requests>=2.12.4->web3)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python363\lib\site-packages (from requests>=2.12.4->web3)
Requirement already satisfied: idna<2.7,>=2.5 in c:\python363\lib\site-packages (from requests>=2.12.4->web3)
Requirement already satisfied: certifi>=2017.4.17 in c:\python363\lib\site-packages (from requests>=2.12.4->web3)
Requirement already satisfied: eth-keys<0.2.0,>=0.1.0b3 in c:\python363\lib\site-packages (from eth-tester==0.1.0b11->web3)
Requirement already satisfied: semantic-version<3.0.0,>=2.6.0 in c:\python363\lib\site-packages (from eth-tester==0.1.0b11->web3)
Installing collected packages: web3
Successfully installed web3-3.16.5
Alright.
Now can you provide me with the full output when you open a python repl and try to import web3. Please include the full output like the following.
$ python
Python 3.5.3 (default, May 3 2017, 10:06:22)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import web3
>>> web3
<module 'web3' from '/Users/piper/sites/web3.py/web3/__init__.py'>
Python 3.6.3 |Anaconda, Inc.| (default, Oct 27 2017, 12:22:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import web3
web3
from web3.auto import w3
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'web3.auto'
from web3 import Web3, IPCProvider
w3 = Web3(IPCProvider('/path/to/node/rpc-json/file.ipc'))
w3.eth.blockNumber
Traceback (most recent call last):
File "C:Python363libsite-packagesweb3utilswindows.py", line 17, in __init__
0, None, win32file.OPEN_EXISTING, 0, None)
pywintypes.error: (3, 'CreateFile', 'Das System kann den angegebenen Pfad nicht finden.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "
File "C:Python363libsite-packagesweb3eth.py", line 92, in blockNumber
return self.web3.manager.request_blocking("eth_blockNumber", [])
File "C:Python363libsite-packagesweb3manager.py", line 93, in request_blocking
response = self._make_request(method, params)
File "C:Python363libsite-packagesweb3manager.py", line 76, in _make_request
return request_func(method, params)
File "C:Python363libsite-packagesweb3middlewareattrdict.py", line 20, in middleware
response = make_request(method, params)
File "C:Python363libsite-packagesweb3middlewareformatting.py", line 25, in middleware
response = make_request(method, params)
File "C:Python363libsite-packagesweb3providersipc.py", line 108, in make_request
with self._lock, self._socket as sock:
File "C:Python363libsite-packagesweb3providersipc.py", line 41, in __enter__
self.sock = self._open()
File "C:Python363libsite-packagesweb3providersipc.py", line 54, in _open
return get_ipc_socket(self.ipc_path)
File "C:Python363libsite-packagesweb3providersipc.py", line 25, in get_ipc_socket
return NamedPipe(ipc_path)
File "C:Python363libsite-packagesweb3utilswindows.py", line 19, in __init__
raise IOError(err)
OSError: (3, 'CreateFile', 'Das System kann den angegebenen Pfad nicht finden.')
Alright, issue is you being on the 3.x line of web3. If you run pip install --pre web3 you should get a 4.x beta version which has the web3.auto module.
Alternatively, if you need to stay on 3.x for some reason, make sure you're browsing the 3.x documentation since a number of things have changed or been added in 4.x
re-open if this doesn't fix your issue.
I had a similar issue with importing from eth_account import Account.
ModuleNotFoundError: No module named 'eth_account'
Based on your suggestions, I did the following:
pip uninstall py-solc
pip uninstall web3
pip install --pre web3
For some reason I had to uninstall py-solc otherwise it kept reinstalling web3 v3.16.5. Not sure why.
I did not re-install py-solc because I do not currently need it.
Most helpful comment
re-open if this doesn't fix your issue.