Error in Pytorch : libcudart.so.10.2: cannot open shared object file: No such file or directory

Viewed 3213

I am running some graph neural networks, and I have the following versions installed:

!pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html
!pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html
!pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html
!pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html 
!pip install torch-geometric
!pip install pytorch_lightning

However, I get the following error:

import pandas as pd
import numpy as np
import os.path as osp
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.loader import DataLoader
from torch_geometric.utils import to_networkx
from random import shuffle, randint
import networkx as nx
import matplotlib.pyplot as plt
import random 
from tqdm import tqdm
import torch.nn.functional as F
from torch.nn import Linear, LayerNorm, ReLU
from torch_scatter import scatter
from torch_geometric.nn import GENConv, DeepGCNLayer
from torch_geometric.data import RandomNodeSampler

I get the following error:

OSError                                   Traceback (most recent call last)
<ipython-input-5-ba81a7ec5178> in <module>()
     14 import torch.nn.functional as F
     15 from torch.nn import Linear, LayerNorm, ReLU
---> 16 from torch_scatter import scatter
     17 from torch_geometric.nn import GENConv, DeepGCNLayer
     18 from torch_geometric.data import RandomNodeSampler

2 frames
/usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: libcudart.so.10.2: cannot open shared object file: No such file or directory

I need some help fixing this.

1 Answers

You must compile your PyG and its extensions with the same CUDA version. It must be the same version that PyTorch uses in your system. Check your CUDA version with torch.version.cuda and use the correct Cuda version in installation commands.

Related