将 Web3 导入 Google Colab 时出错

Cal*_*tta 2 google-colaboratory web3py

我正在尝试在 Google Colab 中安装 web3,第一步是

!pip install web3
Run Code Online (Sandbox Code Playgroud)

这成功地结束了——似乎是——一个微不足道的错误

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
Run Code Online (Sandbox Code Playgroud)

请注意,已安装 jsonschema-3.2.0。
现在我执行

from web3 import Web3 
Run Code Online (Sandbox Code Playgroud)

并得到以下错误

/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'})
Run Code Online (Sandbox Code Playgroud)

我无法理解的是,即使安装了 jsonschema-3.2.0,该错误仍然表明我们仍然坚持使用 jsonschema 2.6.0,即使它已被卸载。请帮忙

Cal*_*tta 5

哦,好吧,我只需要重新安装 jsonschema!

!pip install --force-reinstall jsonschema==3.2.0
Run Code Online (Sandbox Code Playgroud)

这解决了当前的问题