无法使用谷歌colab的stellargraph库

问题描述 投票:0回答:1

我一直在尝试使用 stellargraph 库在 google colab 中运行某个笔记本 我正在使用这个命令来安装stellargraph(所需版本是1.2.1)

注意:我将python更改为3.7.16

%pip install -q stellargraph[demos]==1.2.1

之后我尝试导入库:

import stellargraph as sg

我收到此错误:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-22-ebd46f3ef3a7> in <cell line: 2>()
      1 # verify that we're using the correct version of StellarGraph for this notebook
----> 2 import stellargraph as sg
      3 
      4 try:
      5     sg.utils.validate_notebook_version("1.2.1")

ModuleNotFoundError: No module named 'stellargraph'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

使用命令 pip freeze 或 !pip list 检查现有模块后 我可以看到模块已安装但仍然无法导入它。

这是我尝试运行的笔记本:笔记本链接

尝试安装不同版本的stellargraph并在google colab上降级python版本

python deep-learning google-colaboratory stellargraph
1个回答
0
投票

作为临时解决方案,您可以按照此处提到的解决方案进行操作。

https://github.com/stellargraph/stellargraph/issues/2084#issuecomment-1512663596

您应该首先安装 Tensorflow 2.11.0

!pip install tensorflow==2.11.0

然后,从不同的存储库安装修改后的Python版本库:

!pip install git+https://github.com/VenkateshwaranB/stellargraph.git
© www.soinside.com 2019 - 2024. All rights reserved.