将 Web3 导入 Google Colab 时出错
Error in importing Web3 into Google Colab
我正在尝试在 Google Colab 中安装 web3,第一步是
!pip install web3
这成功地结束了——似乎是——一个微不足道的错误
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
请注意,已安装 jsonschema-3.2.0。
现在我执行
from web3 import Web3
并得到以下错误
/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'})
我无法理解的是,即使安装了 jsonschema-3.2.0,错误仍然显示我们仍然坚持使用 jsonschema 2.6.0,即使它已被卸载。
请帮忙
哦,好吧,我只需要重新安装 jsonschema!
!pip install --force-reinstall jsonschema==3.2.0
解决了当前的问题
我正在尝试在 Google Colab 中安装 web3,第一步是
!pip install web3
这成功地结束了——似乎是——一个微不足道的错误
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
请注意,已安装 jsonschema-3.2.0。
现在我执行
from web3 import Web3
并得到以下错误
/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'})
我无法理解的是,即使安装了 jsonschema-3.2.0,错误仍然显示我们仍然坚持使用 jsonschema 2.6.0,即使它已被卸载。 请帮忙
哦,好吧,我只需要重新安装 jsonschema!
!pip install --force-reinstall jsonschema==3.2.0
解决了当前的问题