zhoux85 / STAligner

STAligner is a tool for alignment and integration of spatially resolved transcriptomics data.
MIT License
29 stars 5 forks source link

import error #6

Open yuntwang opened 1 year ago

yuntwang commented 1 year ago

Hi,when i import STAligner,error:

$python Python 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.

import STAligner terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted

why?

zhoux85 commented 1 year ago

Hi. Are the package Pytorch and PyG correctly installed? Please check them first.

yuntwang commented 1 year ago

HI, these two modules have been successfully installed.

conda install -c pytorch pytorch Retrieving notices: ...working... done Collecting package metadata (current_repodata.json): - WARNING conda.models.version:get_matcher(556): Using . with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1., but conda is ignoring the .* and treating it as 1.7.1 done Solving environment: done

All requested packages already installed.

conda install -c pyg pyg Collecting package metadata (current_repodata.json): | WARNING conda.models.version:get_matcher(556): Using . with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1., but conda is ignoring the .* and treating it as 1.7.1 done Solving environment: done

All requested packages already installed.

But when loading the STAligner module, the same problem still exists:

Python 3.8.18 (default, Sep 11 2023, 13:40:15) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import STAligner
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted
zhoux85 commented 1 year ago

Can you run the following code to test if torch and pyg are correctly installed?

import torch
from torch_geometric.data import Data
from torch_scatter import scatter_max
from torch_sparse import transpose
from torch_cluster import graclus_cluster
yuntwang commented 1 year ago

`$python Python 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.

import torch from torch_geometric.data import Data terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted `

yuntwang commented 1 year ago

Reinstalled the following module

torch==1.9.1
torch-geometric==2.0.3
torch-cluster==1.5.9
torch-scatter==2.0.9
torch-sparse==0.6.12

Recall module

import Python 3.8.18 (default, Sep 11 2023, 13:40:15) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
 import STAligner
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/nas1/wangyt/software/STAligner-master/STAligner/__init__.py", line 13, in <module>
    from .train_STAligner import train_STAligner, train_STAligner_subgraph
  File "/share/nas1/wangyt/software/STAligner-master/STAligner/train_STAligner.py", line 7, in <module>
    from .STALIGNER import STAligner
  File "/share/nas1/wangyt/software/STAligner-master/STAligner/STALIGNER.py", line 9, in <module>
    from .gat_conv import GATConv
  File "/share/nas1/wangyt/software/STAligner-master/STAligner/gat_conv.py", line 2, in <module>
    from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
  File "/share/nas1/wangyt/software/miniconda3/envs/STAligner/lib/python3.8/site-packages/torch_geometric/__init__.py", line 4, in <module>
    import torch_geometric.data
  File "/share/nas1/wangyt/software/miniconda3/envs/STAligner/lib/python3.8/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
    from .data import Data
  File "/share/nas1/wangyt/software/miniconda3/envs/STAligner/lib/python3.8/site-packages/torch_geometric/data/data.py", line 9, in <module>
    from torch_sparse import SparseTensor
  File "/share/nas1/wangyt/software/miniconda3/envs/STAligner/lib/python3.8/site-packages/torch_sparse/__init__.py", line 19, in <module>
    torch.ops.load_library(spec.origin)
  File "/share/nas1/wangyt/software/miniconda3/envs/STAligner/lib/python3.8/site-packages/torch/_ops.py", line 104, in load_library
    ctypes.CDLL(path)
  File "/share/nas1/wangyt/software/miniconda3/envs/STAligner/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory

My server does not have a GPU……

zhoux85 commented 1 year ago

Both torch and pyg have CPU version. If your server dose not have GPU, please install the CPU version. In my experience, CPU version may be easier to be installed.