THUMNLab / AutoGL

An autoML framework & toolkit for machine learning on graphs.
http://mn.cs.tsinghua.edu.cn/AutoGL/
Apache License 2.0
1.09k stars 119 forks source link

[OSError:[WinError 127]找不到指定的程序] pytorch-sparse安装引起 #139

Open LandaChina opened 1 year ago

LandaChina commented 1 year ago

Describe the bug 安装成功dgl和autogl后,import验证时报错,pytorch-sparse安装后python.exe无法找到入口,卸载pytorch-sparse又会提示不存在模块,问题在torch_sparse循环。

To Reproduce

  1. import autogl
  2. 先出现torch_sparse找不到问题,安装wheel
  3. 成功后,import autogl
  4. 再次错误:OSError: [WinError 127] 找不到指定的程序。

    import autogl Traceback (most recent call last): File "", line 1, in File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\autogl__init.py", line 1, in from . import ( File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\autogl\datasets__init.py", line 14, in from ._ogb import ( File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\autogl\datasets_ogb.py", line 8, in from torch_sparse import SparseTensor File "C:\Users\llzhang\AppData\Roaming\Python\Python38\site-packages\torch_sparse\init__.py", line 18, in torch.ops.load_library(spec.origin) File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\torch_ops.py", line 255, in load_library ctypes.CDLL(path) File "C:\Users\All Users\anaconda3\envs\autogl\lib\ctypes\init.py", line 373, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 127] 找不到指定的程序。 并且跳出警告,如下图: image 无法定位程序输入点于动态链接库\torch_sparse_version_cpu.pyd上

Expected behavior 成功import autogl,如何更好的安装torch_sparse,使之成功安装并且不报错。

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional Info (Optional) image 提示的定位不到的动态链接库_version_cpu,本地可以找到几个,替换报错位置的文档,也没有解决。

LandaChina commented 1 year ago

Additional Info: Next, conda uninstall pytorch-scatter, successfully, the error 'OSError:[WinError 127]' happened again. Maybe the wrong is from the torch-sparse wheel installed. The torch_sparse is found from https://[pytorch-geometric.com/whl/torch-2.0.1%2Bcpu.html](https://pytorch-geometric.com/whl/torch-2.0.1%2Bcpu.html).

general502570 commented 1 year ago

谢谢您对AutoGL的关注。pytorch-sparse 的依赖应该是ogb数据集所需要的。您可以试一试能不能直接import ogb库。如果不能的话,请在ogb库的讨论区寻找相关解答。如果可以的话,请再回复给我们。

LandaChina commented 1 year ago

谢谢您对AutoGL的关注。pytorch-sparse 的依赖应该是ogb数据集所需要的。您可以试一试能不能直接import ogb库。如果不能的话,请在ogb库的讨论区寻找相关解答。如果可以的话,请再回复给我们。

成功import ogb!

(autogl) C:\Users\llzhang>python Python 3.8.17 (default, Jul 5 2023, 20:44:21) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information.

import ogb import autogl Traceback (most recent call last): File "", line 1, in File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\autogl__init.py", line 1, in from . import ( File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\autogl\datasets__init.py", line 14, in from ._ogb import ( File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\autogl\datasets_ogb.py", line 8, in from torch_sparse import SparseTensor File "C:\Users\llzhang\AppData\Roaming\Python\Python38\site-packages\torch_sparse\init__.py", line 18, in torch.ops.load_library(spec.origin) File "C:\Users\All Users\anaconda3\envs\autogl\lib\site-packages\torch_ops.py", line 255, in load_library ctypes.CDLL(path) File "C:\Users\All Users\anaconda3\envs\autogl\lib\ctypes\init.py", line 373, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 127] 找不到指定的程序。

但是import autogl还是存在以上问题。

ZW-ZHANG commented 1 year ago

感谢您的回复,该问题看起来是由于torch_sparse库引起的。您可以先试一下直接import torch_sparse能否成功,如过不能的话,请查看torch_sparse寻找相关原因(比如是否为python/torch/gpu版本与torch_sparse库不匹配等)

LandaChina commented 1 year ago

pytorch_sparse 是pytorch的1.6后版本使用,torch-sparse是1.6之前的版本,同时pytorch_sparse没有Windows版本,conda install找不到,从而得出的结论是autogl对操作系统有要求。

ZW-ZHANG commented 1 year ago

您好,可能之前没有说清,我说的是https://github.com/rusty1s/pytorch_sparse 中的torch_sparse,它是pytorch geometric库的一个依赖(虽然您用的是DGL backend,但好像因为ogb或者别的库的依赖,也需要安装torch_sparse)。我个人尝试按照上面网页的说明安装torch_sparse后,是可以在windows下成功运行autogl