Calcutta
Calcutta

Reputation: 1149

Error in importing Web3 into Google Colab

I am trying to install web3 in Google Colab, and the first step is

!pip install web3

this concludes successfully with -- what seems to be -- a trivial error

ERROR: nbclient 0.5.1 has requirement jupyter-client>=6.1.5, but you'll have jupyter-client 5.3.5 which is incompatible.
Installing collected packages: pycryptodome, ... jsonschema,..... eth-account, web3
  Found existing installation: jsonschema 2.6.0
    Uninstalling jsonschema-2.6.0:
      Successfully uninstalled jsonschema-2.6.0
Successfully installed base58-2.0.1 ... jsonschema-3.2.0 ....  web3-5.13.0 websockets-8.1

Note that jsonschema-3.2.0 is installed.
Now I execute

from web3 import Web3 

and get the following error

/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
    773                 # Oops, the "best" so far conflicts with a dependency
    774                 dependent_req = required_by[req]
--> 775                 raise VersionConflict(dist, req).with_context(dependent_req)
    776 
    777             # push the new requirements onto the stack

ContextualVersionConflict: (jsonschema 2.6.0 (/usr/local/lib/python3.6/dist-packages), Requirement.parse('jsonschema<4.0.0,>=3.2.0'), {'web3'})

What I cannot understand is even though jsonschema-3.2.0 is installed, the error still shows that we are still stuck with jsonschema 2.6.0 even though it was uninstalled. Please help

Upvotes: 2

Views: 2840

Answers (1)

Calcutta
Calcutta

Reputation: 1149

oh well, i just had to reinstall jsonschema!

!pip install --force-reinstall jsonschema==3.2.0

which fixes the current problem

Upvotes: 5

Related Questions