Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch_sparse/_convert_cpu.so: undefined symbol: _ZNK2at6Tensor5zero_Ev #248

Closed
shuimei opened this issue Nov 5, 2021 · 20 comments
Closed
Labels

Comments

@shuimei
Copy link

shuimei commented Nov 5, 2021

code:
In [1]: import torch
In [2]: from torch_geometric.data import Data

error:

OSError Traceback (most recent call last)
in ()
----> 1 from torch_geometric.data import Data

~/anaconda3/lib/python3.7/site-packages/torch_geometric/init.py in ()
5 from .debug import is_debug_enabled, debug, set_debug
6
----> 7 import torch_geometric.data
8 import torch_geometric.loader
9 import torch_geometric.transforms

~/anaconda3/lib/python3.7/site-packages/torch_geometric/data/init.py in ()
----> 1 from .data import Data
2 from .hetero_data import HeteroData
3 from .temporal import TemporalData
4 from .batch import Batch
5 from .dataset import Dataset

~/anaconda3/lib/python3.7/site-packages/torch_geometric/data/data.py in ()
1 from typing import (Optional, Dict, Any, Union, List, Iterable, Tuple,
2 NamedTuple, Callable)
----> 3 from torch_geometric.typing import OptTensor, NodeType, EdgeType
4 from torch_geometric.deprecation import deprecated
5

~/anaconda3/lib/python3.7/site-packages/torch_geometric/typing.py in ()
2
3 from torch import Tensor
----> 4 from torch_sparse import SparseTensor
5
6 # Types for accessing data ####################################################

~/anaconda3/lib/python3.7/site-packages/torch_sparse/init.py in ()
14 ]:
15 torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
---> 16 f'{library}_{suffix}', [osp.dirname(file)]).origin)
17
18 if torch.cuda.is_available(): # pragma: no cover

~/anaconda3/lib/python3.7/site-packages/torch/_ops.py in load_library(self, path)
108 # static (global) initialization code in order to register custom
109 # operators with the JIT.
--> 110 ctypes.CDLL(path)
111 self.loaded_libraries.add(path)
112

~/anaconda3/lib/python3.7/ctypes/init.py in init(self, name, mode, handle, use_errno, use_last_error)
354
355 if handle is None:
--> 356 self._handle = _dlopen(self._name, mode)
357 else:
358 self._handle = handle

OSError: /root/anaconda3/lib/python3.7/site-packages/torch_sparse/_convert_cpu.so: undefined symbol: _ZNK2at6Tensor5zero_Ev

I followed the Quick Start installation, with torch=1.10.0+cu102

@rusty1s
Copy link
Owner

rusty1s commented Nov 8, 2021

This is related to a potentially false intallation of torch-sparse. Can you show me the installation log when running:

pip uninstall torch-sparse
pip uninstall torch-sparse
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu102.html

@guillaumehu
Copy link

There is the same issue when running the Colab Notebooks tutorials.

@rusty1s
Copy link
Owner

rusty1s commented Nov 12, 2021

Colab notebooks are fixable as suggested here: pyg-team/pytorch_geometric#3484

@guillaumehu
Copy link

Great, thanks a lot !

@dreamcoils
Copy link

This is related to a potentially false intallation of torch-sparse. Can you show me the installation log when running:

pip uninstall torch-sparse
pip uninstall torch-sparse
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu102.html

it works!!
thanks a lot!

@shuimei
Copy link
Author

shuimei commented Nov 14, 2021

Found existing installation: torch-sparse 0.6.12 Uninstalling torch-sparse-0.6.12: Would remove: /root/anaconda3/lib/python3.7/site-packages/test/* /root/anaconda3/lib/python3.7/site-packages/torch_sparse-0.6.12.dist-info/* /root/anaconda3/lib/python3.7/site-packages/torch_sparse/* Would not remove (might be manually added): /root/anaconda3/lib/python3.7/site-packages/test/test_basis.py /root/anaconda3/lib/python3.7/site-packages/test/test_broadcasting.py /root/anaconda3/lib/python3.7/site-packages/test/test_conv.py /root/anaconda3/lib/python3.7/site-packages/test/test_fps.py /root/anaconda3/lib/python3.7/site-packages/test/test_gather.py /root/anaconda3/lib/python3.7/site-packages/test/test_graclus.py /root/anaconda3/lib/python3.7/site-packages/test/test_grid.py /root/anaconda3/lib/python3.7/site-packages/test/test_knn.py /root/anaconda3/lib/python3.7/site-packages/test/test_multi_gpu.py /root/anaconda3/lib/python3.7/site-packages/test/test_nearest.py /root/anaconda3/lib/python3.7/site-packages/test/test_radius.py /root/anaconda3/lib/python3.7/site-packages/test/test_rw.py /root/anaconda3/lib/python3.7/site-packages/test/test_sampler.py /root/anaconda3/lib/python3.7/site-packages/test/test_scatter.py /root/anaconda3/lib/python3.7/site-packages/test/test_segment.py /root/anaconda3/lib/python3.7/site-packages/test/test_weighting.py /root/anaconda3/lib/python3.7/site-packages/test/test_zero_tensors.py Proceed (Y/n)? Successfully uninstalled torch-sparse-0.6.12 ~

pip install torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu102.html Looking in links: https://data.pyg.org/whl/torch-1.10.0+cu102.html Collecting torch-sparse Downloading https://data.pyg.org/whl/torch-1.10.0%2Bcu102/torch_sparse-0.6.12-cp37-cp37m-linux_x86_64.whl (2.9 MB) |████████████████████████████████| 2.9 MB 500 kB/s Requirement already satisfied: scipy in ./anaconda3/lib/python3.7/site-packages (from torch-sparse) (1.1.0) Installing collected packages: torch-sparse

but the problem remains
now another OSError occurs:
OSError: /root/anaconda3/lib/python3.7/site-packages/torch_scatter/_scatter_cpu.so: undefined symbol: _ZNK2at6Tensor6narrowElll

my torch version is 1.10.0+cu102

@rusty1s
Copy link
Owner

rusty1s commented Nov 15, 2021

You also need to uninstall and update torch-scatter, similarly to how you did it with torch-sparse.

@github-actions
Copy link

This issue had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity. Is this issue already resolved?

@jingyanliao
Copy link

I'm trying to solve the same problem under torch 1.10.0+cu111, but after re-installing torch-scatter and torch-sparse the problem is still unsolved.

command I used:
pip uninstall torch-scatter pip uninstall torch-sparse pip install torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu111.html pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cu111.html

@rusty1s
Copy link
Owner

rusty1s commented May 7, 2023

Can you install via

pip install torch-scatter==2.0.9 -f https://data.pyg.org/whl/torch-1.10.0+cu111.html

@Sparrow711
Copy link

Hey! I am having the same problem. And I tried to resolve this issue using the solution mentioned in this thread. Following is the error that I receive:

/home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_geometric/typing.py:31: UserWarning: An issue occurred while importing 'torch-scatter'. Disabling its usage. Stacktrace: /home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_scatter/_scatter_cuda.so: undefined symbol: _ZNK3c107SymBool10guard_boolEPKcl
warnings.warn(f"An issue occurred while importing 'torch-scatter'. "
Traceback (most recent call last):
File "/home/anshal/summer_intern/Pointcept-main/exp/scannet/semseg-pt-v2m2-0-base/code/tools/train.py", line 9, in
from pointcept.engines.train import Trainer
File "/home/anshal/summer_intern/Pointcept-main/exp/scannet/semseg-pt-v2m2-0-base/code/pointcept/engines/train.py", line 25, in
from pointcept.models import build_model
File "/home/anshal/summer_intern/Pointcept-main/exp/scannet/semseg-pt-v2m2-0-base/code/pointcept/models/init.py", line 7, in
from .point_transformer_v2 import *
File "/home/anshal/summer_intern/Pointcept-main/exp/scannet/semseg-pt-v2m2-0-base/code/pointcept/models/point_transformer_v2/init.py", line 8, in
from .point_transformer_v2m1_origin import *
File "/home/anshal/summer_intern/Pointcept-main/exp/scannet/semseg-pt-v2m2-0-base/code/pointcept/models/point_transformer_v2/point_transformer_v2m1_origin.py", line 14, in
from torch_scatter import segment_csr
File "/home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_scatter/init.py", line 16, in
torch.ops.load_library(spec.origin)
File "/home/anshal/.local/lib/python3.10/site-packages/torch/_ops.py", line 573, in load_library
ctypes.CDLL(path)
File "/home/anshal/anaconda3/envs/pointcept/lib/python3.10/ctypes/init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: /home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_scatter/_scatter_cuda.so: undefined symbol: _ZNK3c107SymBool10guard_boolEPKcl
/home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_geometric/typing.py:31: UserWarning: An issue occurred while importing 'torch-scatter'. Disabling its usage. Stacktrace: /home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_scatter/_scatter_cuda.so: undefined symbol: _ZNK3c107SymBool10guard_boolEPKcl
warnings.warn(f"An issue occurred while importing 'torch-scatter'. "
Traceback (most recent call last):
File "/home/anshal/summer_intern/Pointcept-main/tools/train.py", line 9, in
from pointcept.engines.train import Trainer
File "/home/anshal/summer_intern/Pointcept-main/pointcept/engines/train.py", line 25, in
from pointcept.models import build_model
File "/home/anshal/summer_intern/Pointcept-main/pointcept/models/init.py", line 7, in
from .point_transformer_v2 import *
File "/home/anshal/summer_intern/Pointcept-main/pointcept/models/point_transformer_v2/init.py", line 8, in
from .point_transformer_v2m1_origin import *
File "/home/anshal/summer_intern/Pointcept-main/pointcept/models/point_transformer_v2/point_transformer_v2m1_origin.py", line 14, in
from torch_scatter import segment_csr
File "/home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_scatter/init.py", line 16, in
torch.ops.load_library(spec.origin)
File "/home/anshal/.local/lib/python3.10/site-packages/torch/_ops.py", line 573, in load_library
ctypes.CDLL(path)
File "/home/anshal/anaconda3/envs/pointcept/lib/python3.10/ctypes/init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: /home/anshal/anaconda3/envs/pointcept/lib/python3.10/site-packages/torch_scatter/_scatter_cuda.so: undefined symbol: _ZNK3c107SymBool10guard_boolEPKcl

I installed pytorch version 2.0.1, cuda 11.7 and torch-scatter 2.1.1

@Sruthik22
Copy link

I also have the same issue: OSError: .conda/envs/GIGN/lib/python3.9/site-packages/torch_sparse/_version_cpu.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

@rusty1s
Copy link
Owner

rusty1s commented Jul 25, 2023

This usually indicates a version conflict, so something with your CUDA and PyTorch version does not match with the installed version coming from torch-scatter. Any additional information about your system and how you installed torch-scatter would let me help you better.

@Sparrow711
Copy link

I have cuda 11.7 installed on my laptop. And in the conda environment I have pytorch 2.0.1 for cuda 11.7, torch-scatter (2.1.1+pt20cu117). And I used the following command to install pytorch-scatter, pytorch-sparse and pytorch cluster:
conda install pytorch-cluster pytorch-scatter pytorch-sparse -c pyg -y

@rusty1s
Copy link
Owner

rusty1s commented Jul 27, 2023

How did you install PyTorch? It is preferred that you install it from the official binaries (not from something like conda-forge).

@Sparrow711
Copy link

I installed Pytorch using the instructions on their site. I used the following:
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

@rusty1s
Copy link
Owner

rusty1s commented Aug 7, 2023

Thanks for sharing. Can you try to run install torch-scatter (and so on) via pip (with -f option) rather than via conda? Note that you may need to uninstall the conda versions of it first. This should help me to track down the issue better.

@rookiie1918
Copy link

OSError: /home/lijuncai/app/anaconda3/envs/ljc/lib/python3.9/site-packages/torch_cluster/_grid_cuda.so: undefined symbol: _ZNK3c1010TensorImpl36is_contiguous_nondefault_policy_implENS_12MemoryFormatE
torch_version is 1.12.1+cu102

@mainguyenanhvu
Copy link

I found the solution here.

@viettham1998
Copy link

I also have the same issue:
OSError: /home/hvtham/.local/lib/python3.10/site-packages/torch_sparse/_convert_cpu.so: undefined symbol: _ZN3c1013ParallelGuardC1Eb

My torch_version is 2.2.1+cu121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants