Closed toooooodo closed 2 years ago
It seems you are using conda environment. Could you try pip uninstall dgl and use conda install dgl-cuda11.0 instead?
I try pip uninstall dgl and use conda install dgl-cuda11.0, but the same errors also occur.
How did you install pytorch? Did you use conda install torch with the same cuda version as dgl? How did you install cuda also, by conda install or using system library?
I installed pytorch using pip install offline. I check torch and dgl version, they are compatible with cuda version. I use cuda system library, and there is no problem running the following code.
import torch
device = torch.device('cuda:0')
x = torch.randn((5,100)).to(device)
linear = torch.nn.Linear(100, 50).to(device)
x = linear(x)
I tried another example, and the same error occurred.
import torch.nn.functional as F
from dgl.nn import GraphConv
import torch.nn as nn
import torch
class Classifier(nn.Module):
def __init__(self, in_dim, out_dim):
super(Classifier, self).__init__()
self.conv1 = GraphConv(in_dim, out_dim,)
def forward(self, g, h):
# Apply graph convolution and activation.
h = F.relu(self.conv1(g, h))
return h
src_ids = torch.tensor([2, 3, 4])
dst_ids = torch.tensor([1, 2, 3])
device = torch.device('cuda:0')
g = dgl.graph((src_ids, dst_ids)).to(device)
g = dgl.add_self_loop(g)
x = torch.randn((5, 100)).to(device)
model = Classifier(100, 20).to(device)
model(g, x)
@toooooodo pip uninstall dgl
will not remove dgl-cu110 installed with pip. Please check your dgl installation path via
import dgl
print(dgl.__path__)
Actually I uninstalled using pip uninstall dgl-cu110
, and the output of dgl.__path__
is ['/data/zhuangxiang/anaconda3/lib/python3.8/site-packages/dgl']
This issue has been automatically marked as stale due to lack of activity. It will be closed if no further activity occurs. Thank you
This issue is closed due to lack of activity. Feel free to reopen it if you still have questions.
Whether dgl.nn. GraphConv really exists
I come to the same problem with you , I want to know if you solve it?
I also face the same problem , Does this question have any solutions now?
I come to the same problem with you , I want to know if you solve it?
Hello, did you figure it out? I want to know how to slove it.
Actually I uninstalled using
pip uninstall dgl-cu110
, and the output ofdgl.__path__
is['/data/zhuangxiang/anaconda3/lib/python3.8/site-packages/dgl']
Hello, I have encountered the same problem. Have you resolved it yet
No, I update the cuda to 11.6 and install other version
发件人: 毛日强 @.> 发送时间: 2023年12月8日 10:49 收件人: dmlc/dgl @.> 抄送: Leon stark @.>; Comment @.> 主题: Re: [dmlc/dgl] dgl._ffi.base.DGLError: [13:15:35] /opt/dgl/src/array/cuda/spmm.cu:213: Check failed: e == CUSPARSE_STATUS_SUCCESS: CUSPARSE ERROR: 1 (#2762)
Actually I uninstalled using pip uninstall dgl-cu110, and the output of dgl.path is ['/data/zhuangxiang/anaconda3/lib/python3.8/site-packages/dgl'] Hello, I have encountered the same problem. Have you resolved it yet
― Reply to this email directly, view it on GitHubhttps://github.com/dmlc/dgl/issues/2762#issuecomment-1846472032, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKRWZ62FKIKMIQCN34VYA4DYIJ55DAVCNFSM4ZMUCIL2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBUGY2DOMRQGMZA. You are receiving this because you commented.Message ID: @.***>
I also tried to get this example code working, this is what worked for me.
After a lot of back and forth trying to match python
,pytorch
and cuda
versions [1], the following steps worked for me. (It's easier to start with a new environment because there might be lots of conflicts going on with packages)
[1] - https://www.dgl.ai/pages/start.html
## Create new environment, use arbitrary name "myenv" that you prefer
conda create -n myenv python=3.11
## Activate environment
source activate myenv
## Install pytorch 2.2
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia
## Install dgl which matches pytorch 2.2 and cuda 12.1
conda install -c dglteam/label/cu121 dgl
## Add environment to jupyter kernel
conda install -c anaconda ipykernel -y
python -m ipykernel install --user --name=myenv
# install remaining things that dgl needs
pip install torchdata
pip install pandas
pip install pyyaml
pip install pydantic
I tried another example, and the same error occurred.
import torch.nn.functional as F import dgl from dgl.nn import GraphConv import torch.nn as nn import torch class Classifier(nn.Module): def __init__(self, in_dim, out_dim): super(Classifier, self).__init__() self.conv1 = GraphConv(in_dim, out_dim,) def forward(self, g, h): # Apply graph convolution and activation. h = F.relu(self.conv1(g, h)) return h src_ids = torch.tensor([2, 3, 4]) dst_ids = torch.tensor([1, 2, 3]) device = torch.device('cuda:0') g = dgl.graph((src_ids, dst_ids)).to(device) g = dgl.add_self_loop(g) x = torch.randn((5, 100)).to(device) model = Classifier(100, 20).to(device) model(g, x)
This works for me. Thanks! Anyone who meets the errors on GPU 4090 could try this solution.
I also tried to get this example code working, this is what worked for me.
After a lot of back and forth trying to match
python
,pytorch
andcuda
versions [1], the following steps worked for me. (It's easier to start with a new environment because there might be lots of conflicts going on with packages)[1] - https://www.dgl.ai/pages/start.html
## Create new environment, use arbitrary name "myenv" that you prefer conda create -n myenv python=3.11 ## Activate environment source activate myenv ## Install pytorch 2.2 conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia ## Install dgl which matches pytorch 2.2 and cuda 12.1 conda install -c dglteam/label/cu121 dgl ## Add environment to jupyter kernel conda install -c anaconda ipykernel -y python -m ipykernel install --user --name=myenv # install remaining things that dgl needs pip install torchdata pip install pandas pip install pyyaml pip install pydantic
I tried another example, and the same error occurred.
import torch.nn.functional as F import dgl from dgl.nn import GraphConv import torch.nn as nn import torch class Classifier(nn.Module): def __init__(self, in_dim, out_dim): super(Classifier, self).__init__() self.conv1 = GraphConv(in_dim, out_dim,) def forward(self, g, h): # Apply graph convolution and activation. h = F.relu(self.conv1(g, h)) return h src_ids = torch.tensor([2, 3, 4]) dst_ids = torch.tensor([1, 2, 3]) device = torch.device('cuda:0') g = dgl.graph((src_ids, dst_ids)).to(device) g = dgl.add_self_loop(g) x = torch.randn((5, 100)).to(device) model = Classifier(100, 20).to(device) model(g, x)
🐛 Bug
To Reproduce
I run the tutorial code, but errors occur.
Errors:
The above code runs correctly on cpu but goes wrong on gpu.
Environment
conda
,pip
, source): pipAdditional context