Search code examples
pythonjupyter-notebookweb3py

ModuleNotFoundError: No module named 'web3' on jupyter notebook


I am trying to run the following code in Jupyter Notebook using Anaconda (I used pip to install web3):

from web3 import Web3
w3=web3.Web3(web3.Web3.HTTPProvider("http://172.18.0.1:8545"))
w3=util.connect(host="172.18.0.8",port="8545",poa=True)
assert w3.isConnected()

However, I get this Error Stack:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-10-0c63a16e1a59> in <module>
----> 1 from web3 import Web3
      2 
      3 w3=web3.Web3(web3.Web3.HTTPProvider("http://172.18.0.1:8545"))
      4 w3=util.connect(host="172.18.0.8",port="8545",poa=True)
      5 assert w3.isConnected()

ModuleNotFoundError: No module named 'web3'

Anyone knows how to resolve this?


Solution

  • Okay, so I managed to find the answer myself with the help of @NicolaLandro: I did not use the command in the notebook.

    However it worked, when I tried pip install web3 inside the conda prompt, after activating conda environment.