Can't import GCL after installation
mhadnanali opened this issue · comments
My installation is complete but I can't import it, Even I verified its installation location, I can import other packages in the same folder but can not import this one.
I have posted the question on StackOverflow https://stackoverflow.com/questions/69527466/package-import-error-after-installation-with-pip-install
It has screenshots and a detailed description.
Hi,
Thanks for your interest on our work!
I have tried pip install
on my side. It works normally.
May you confirm that the GCL
folder in your importing directory contains __init__.py
?
It should be like
> cat ~/anaconda3/lib/python3.8/site-packages/GCL/__init__.py
import GCL.losses
import GCL.augmentors
import GCL.eval
import GCL.models
import GCL.utils
__version__ = '0.1.0'
__all__ = [
'__version__',
'losses',
'augmentors',
'eval',
'models',
'utils'
]
torch_sparse
is a dependency for pytorch-geometric
. You may install it via conda install pyg -c pyg -c conda-forge
.
OSError: /home/adnan/.conda/envs/forPyGCL/lib/python3.9/site-packages/torch_sparse/_version_cpu.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs
Thats why I asked do I need CPU or GPU version haha. I think it need GPU version. Am I right?
It should work for both CPU and GPU. In our development, we use the GPU version.
I guess you can have a try to install by manually building the source code. The conda package has the binaries precompiled so limited choices are offered.
pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.9.0+cpu.html
so here is the error. Seems like it errors in torch_sparse
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_753530/1655132982.py in <module>
1 import dgl
2 import idna
----> 3 import GCL
4 import GCL.losses as L
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/__init__.py in <module>
1 import GCL.losses
----> 2 import GCL.augmentors
3 import GCL.eval
4 import GCL.models
5 import GCL.utils
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/augmentors/__init__.py in <module>
1 from .augmentor import Graph, Augmentor, Compose, RandomChoice
2 from .identity import Identity
----> 3 from .rw_sampling import RWSampling
4 from .ppr_diffusion import PPRDiffusion
5 from .markov_diffusion import MarkovDiffusion
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/augmentors/rw_sampling.py in <module>
1 from GCL.augmentors.augmentor import Graph, Augmentor
----> 2 from GCL.augmentors.functional import random_walk_subgraph
3
4
5 class RWSampling(Augmentor):
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/augmentors/functional.py in <module>
5 from typing import Optional
6 from GCL.utils import normalize
----> 7 from torch_sparse import SparseTensor, coalesce
8 from torch_scatter import scatter
9 from torch_geometric.transforms import GDC
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/torch_sparse/__init__.py in <module>
13 '_relabel'
14 ]:
---> 15 torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
16 f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
17
AttributeError: 'NoneType' object has no attribute 'origin'
Then I installed/updated via conda install pyg -c pyg -c conda-forge
Error Changes to
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
/tmp/ipykernel_753530/1655132982.py in <module>
1 import dgl
2 import idna
----> 3 import GCL
4 import GCL.losses as L
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/__init__.py in <module>
1 import GCL.losses
----> 2 import GCL.augmentors
3 import GCL.eval
4 import GCL.models
5 import GCL.utils
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/augmentors/__init__.py in <module>
1 from .augmentor import Graph, Augmentor, Compose, RandomChoice
2 from .identity import Identity
----> 3 from .rw_sampling import RWSampling
4 from .ppr_diffusion import PPRDiffusion
5 from .markov_diffusion import MarkovDiffusion
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/augmentors/rw_sampling.py in <module>
1 from GCL.augmentors.augmentor import Graph, Augmentor
----> 2 from GCL.augmentors.functional import random_walk_subgraph
3
4
5 class RWSampling(Augmentor):
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/GCL/augmentors/functional.py in <module>
5 from typing import Optional
6 from GCL.utils import normalize
----> 7 from torch_sparse import SparseTensor, coalesce
8 from torch_scatter import scatter
9 from torch_geometric.transforms import GDC
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/torch_sparse/__init__.py in <module>
13 '_relabel'
14 ]:
---> 15 torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
16 f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
17
~/.conda/envs/forPyGCL/lib/python3.9/site-packages/torch/_ops.py in load_library(self, path)
102 # static (global) initialization code in order to register custom
103 # operators with the JIT.
--> 104 ctypes.CDLL(path)
105 self.loaded_libraries.add(path)
106
~/.conda/envs/forPyGCL/lib/python3.9/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
380
381 if handle is None:
--> 382 self._handle = _dlopen(self._name, mode)
383 else:
384 self._handle = handle
OSError: /home/adnan/.conda/envs/forPyGCL/lib/python3.9/site-packages/torch_sparse/_convert_cuda.so: undefined symbol: _ZNK2at6Tensor6deviceEv
does this mean? I have no hope? as I am client of my lab server and I cant update cuda, while I cant use pyg 1.9 and there is no option to use 1.8. as it supports cuda 10.1
I am a little confused by your required version. We develop PyGCL using PyG 1.7. Are you referring to the PyTorch version? We develop our code library based on PyTorch 1.9 since we use some of its new features. But you may try to alternate the required PyTorch version at https://github.com/GraphCL/PyGCL/blob/main/setup.cfg#L27
to 1.8 and install locally by typing pip install .
.
all I want is to just install and use PyGCL, if it works with PyG 1.7 I try with this one.
It works well with PyG 1.7 by design
For future references: PyG 1.8 did not worked. so I installed 1.7, Seems like working. I will check it more extensively and update if it will have any issue.
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.7.0+cu101.html
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.7.0+cu101.html
pip install torch-geometric
It does not work. could you please display "pip list"? I would like to see your version