Closed faysalhossain2007 closed 2 years ago
Hi! I heard of this problem when using python=3.8 recently. Could you try to change to python=3.9? Also, pytorch geometric is now available on conda. If the python change does not solve the problem, you could try installing it that way: https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html
can you tell me which version of the packages worked for you? Currently these are the packages that I installed in the conda environment:
conda list
# packages in environment at /home/faysal/anaconda3/envs/pyg:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 4.5 1_gnu
blas 1.0 mkl
boost 1.74.0 py38hc10631b_3 conda-forge
boost-cpp 1.74.0 h9359b55_0 conda-forge
bottleneck 1.3.4 py38hce1f21e_0
brotlipy 0.7.0 py38h27cfd23_1003
bzip2 1.0.8 h7b6447c_0
ca-certificates 2020.10.14 0 anaconda
cairo 1.16.0 hf32fb01_1
certifi 2021.10.8 py38h06a4308_2
cffi 1.15.0 py38hd667e15_1
charset-normalizer 2.0.4 pyhd3eb1b0_0
colorama 0.4.4 pyh9f0ad1d_0 conda-forge
cryptography 36.0.0 py38h9ce1e76_0
cudatoolkit 11.3.1 h2bc3f7f_2
cycler 0.11.0 pyhd8ed1ab_0 conda-forge
decorator 4.4.2 py_0 anaconda
dgl 0.8.1 py38_0 dglteam
ffmpeg 4.3 hf484d3e_0 pytorch
fontconfig 2.13.1 h6c09931_0
freetype 2.11.0 h70c0345_0
giflib 5.2.1 h7b6447c_0
glib 2.69.1 h4ff587b_1
gmp 6.2.1 h2531618_2
gnutls 3.6.15 he1e5248_0
greenlet 1.1.1 py38h295c915_0
icu 67.1 he1b5a44_0 conda-forge
idna 3.3 pyhd3eb1b0_0
intel-openmp 2021.4.0 h06a4308_3561
jinja2 3.1.1 pypi_0 pypi
joblib 1.1.0 pyhd8ed1ab_0 conda-forge
jpeg 9d h7f8727e_0
kiwisolver 1.3.2 py38h295c915_0
lame 3.100 h7b6447c_0
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.35.1 h7274673_9
libffi 3.3 he6710b0_2
libgcc-ng 9.3.0 h5101ec6_17
libgfortran-ng 7.5.0 ha8ba4b0_17
libgfortran4 7.5.0 ha8ba4b0_17
libgomp 9.3.0 h5101ec6_17
libiconv 1.15 h63c8f33_5
libidn2 2.3.2 h7f8727e_0
libpng 1.6.37 hbc83047_0
libstdcxx-ng 9.3.0 hd4cf53a_17
libtasn1 4.16.0 h27cfd23_0
libtiff 4.2.0 h85742a9_0
libunistring 0.9.10 h27cfd23_0
libuuid 1.0.3 h7f8727e_2
libuv 1.40.0 h7b6447c_0
libwebp 1.2.2 h55f646e_0
libwebp-base 1.2.2 h7f8727e_0
libxcb 1.14 h7b6447c_0
libxml2 2.9.10 h72b56ed_2 conda-forge
littleutils 0.2.2 py_0 conda-forge
lz4-c 1.9.3 h295c915_1
markupsafe 2.1.1 pypi_0 pypi
matplotlib-base 3.3.4 py38h0efea84_0 conda-forge
mkl 2021.4.0 h06a4308_640
mkl-service 2.4.0 py38h7f8727e_0
mkl_fft 1.3.1 py38hd3c417c_0
mkl_random 1.2.2 py38h51133e4_0
ncurses 6.3 h7f8727e_2
nettle 3.7.3 hbbd107a_1
networkx 2.5 py_0 anaconda
numexpr 2.8.1 py38h6abb31d_0
numpy 1.21.5 py38he7a7128_1
numpy-base 1.21.5 py38hf524024_1
ogb 1.3.3 pypi_0 pypi
openh264 2.1.1 h4ff587b_0
openssl 1.1.1n h7f8727e_0
outdated 0.2.1 pypi_0 pypi
packaging 21.3 pyhd8ed1ab_0 conda-forge
pandas 1.4.2 pypi_0 pypi
pcre 8.45 h9c3ff4c_0 conda-forge
pillow 9.0.1 py38h22f2fdc_0
pip 21.2.4 py38h06a4308_0
pixman 0.40.0 h36c2ea0_0 conda-forge
pycairo 1.19.1 py38h708ec4a_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 22.0.0 pyhd3eb1b0_0
pyparsing 3.0.8 pyhd8ed1ab_0 conda-forge
pysocks 1.7.1 py38h06a4308_0
python 3.8.13 h12debd9_0
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python_abi 3.8 2_cp38 conda-forge
pytorch 1.11.0 py3.8_cuda11.3_cudnn8.2.0_0 pytorch
pytorch-mutex 1.0 cuda pytorch
pytz 2022.1 pyhd8ed1ab_0 conda-forge
rdkit 2020.09.5 py38h2bca085_0 conda-forge
readline 8.1.2 h7f8727e_1
reportlab 3.5.68 py38hadf75a6_0 conda-forge
requests 2.27.1 pyhd3eb1b0_0
scikit-learn 1.0.2 py38h51133e4_1
scipy 1.8.0 pypi_0 pypi
setuptools 61.2.0 py38h06a4308_0
six 1.16.0 pyhd3eb1b0_1
sqlalchemy 1.4.13 py38h497a2fe_0 conda-forge
sqlite 3.38.2 hc218d9a_0
threadpoolctl 3.1.0 pyh8a188c0_0 conda-forge
tk 8.6.11 h1ccaba5_0
torch-cluster 1.6.0 pypi_0 pypi
torch-geometric 2.0.4 pypi_0 pypi
torch-scatter 2.0.9 pypi_0 pypi
torch-sparse 0.6.13 pypi_0 pypi
torch-spline-conv 1.2.1 pypi_0 pypi
torchaudio 0.11.0 py38_cu113 pytorch
torchvision 0.12.0 py38_cu113 pytorch
tornado 6.1 py38h497a2fe_1 conda-forge
tqdm 4.64.0 pyhd8ed1ab_0 conda-forge
typing_extensions 4.1.1 pyh06a4308_0
urllib3 1.26.8 pyhd3eb1b0_0
wheel 0.37.1 pyhd3eb1b0_0
xz 5.2.5 h7b6447c_0
zlib 1.2.12 h7f8727e_1
zstd 1.4.9 haebb681_0
I installed python 3.9 along with pytorch and torchvision as follow-
conda create --name=pyg9 python=3.9
conda activate pyg9
conda install pyg -c pyg
conda install torchvision
conda install ogb
but it is still having the same issue.
note that while running the code for the first time, I experience the following error:
ImportError: cannot import name 'container_abcs' from 'torch._six' (/home/faysal/anaconda3/envs/pyg9/lib/python3.9/site-packages/torch/_six.py)
I changed it to import collections.abc as container_abcs
(according to http://github.com/NVIDIA/apex/issues/1048)
We used these versions for development. It is definitely a good idea to first try with those!
Generally, this seems to be a PyG / PyTorch issue... I am sorry but I am afraid that we are not the right source for support. I would assume you get it running with the versions we used. Otherwise, I would suggest that you open an issue on the PyG GitHub.
Thanks for the help! At last I am able to run the code with small dataset with a few modification to the code.
Thought of other might get help so posting here my detailed approach:
conda create --name=pyg9 python=3.9
conda activate pyg9
conda install pyg -c pyg
conda install torchvision
conda install ogb
In main.py
=> I move from ogb.graphproppred import Evaluator
to the beginning of the file
In src/data/dataloader.py
=>
import torch
from torch.utils.data.dataloader import default_collate
from torch_geometric.data import Data, Batch
from torch._six import string_classes
import collections.abc as container_abcs
In Line 44: I applied the following modifications:
elif isinstance(elem, int_classes):
changed to elif isinstance(elem, int):
Hi I am able to run from torch_geometric.data import InMemoryDataset successfully. But whenever I try to import anything from ogb, the program stuck for infinite time. Import code is:
from ogb.graphproppred import Evaluator
I followed the following command to install torch in conda environment:
CUDA=cu113 TORCH=1.11.0 pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html pip install torch-geometric Note that, I am using Ubuntu. My Nvidia-smi output:
$ nvidia-smi Wed Apr 20 05:09:04 2022
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 450.119.03 Driver Version: 450.119.03 CUDA Version: 11.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 GeForce GTX 1070 Off | 00000000:01:00.0 On | N/A | | 27% 36C P8 9W / 151W | 1227MiB / 8116MiB | 1% Default | | | | N/A