Google colaboratory 上下文版本冲突错误,Google colab
我正在尝试在Google colab上安装并运行sunpy。它需要astropy 3.1版或更高版本的软件包。即使在安装astropy 3.2.1版之后,当我导入sunpy时,也会出现以下错误:Google colaboratory 上下文版本冲突错误,Google colab,google-colaboratory,Google Colaboratory,我正在尝试在Google colab上安装并运行sunpy。它需要astropy 3.1版或更高版本的软件包。即使在安装astropy 3.2.1版之后,当我导入sunpy时,也会出现以下错误: ContextualVersionConflict Traceback (most recent call last) <ipython-input-10-1a62dedba559> in <module>() ----> 1 import sunpy 5
ContextualVersionConflict Traceback (most recent call last)
<ipython-input-10-1a62dedba559> in <module>()
----> 1 import sunpy
5 frames
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in
resolve(self, requirements, env, installer, replace_conflicting,
extras)
789 # Oops, the "best" so far conflicts with a
dependency
790 dependent_req = required_by[req]
--> 791 raise VersionConflict(dist,
req).with_context(dependent_req)
792
793 # push the new requirements onto the stack
ContextualVersionConflict: (astropy 3.0.5
(/usr/local/lib/python3.6/dist-packages),
Requirement.parse('astropy>=3.1'), {'sunpy'})
如何解决此问题?手动安装astropy>=3.1,就像sunpy之前那样:
!pip install astropy>=3.1
!pip install sunpy
然后,使用runtime->restart runtime菜单重新启动运行时以获取新的astropy。最后,导入sunpy
下面是一个成功的例子:
!pip install astropy>=3.1
!pip install sunpy