torchdrug icon indicating copy to clipboard operation
torchdrug copied to clipboard

Error installing OSError undefined symbols

Open rmurphy2718 opened this issue 4 years ago • 6 comments

Background

I am facing installation issues. Note, my installation is in a fresh conda environment, and my only manual installs were numpy and pytorch before running

conda install -c milagraph -c conda-forge torchdrug

Details below, and happy to provide more info. Thanks!

System and Conda Env Info

System information Ubuntu 20.04.2 LTS, 64-bit No GPU

python --version
> Python 3.8.8
conda --version
> conda 4.10.3
conda --list
># Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             4.5                       1_gnu  
alsa-lib                  1.2.3                h516909a_0    conda-forge
boost                     1.74.0           py38hc10631b_3    conda-forge
boost-cpp                 1.74.0               h312852a_4    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2021.5.30            ha878542_0    conda-forge
cairo                     1.16.0            h6cf1ce9_1008    conda-forge
certifi                   2021.5.30        py38h578d9bd_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
cpuonly                   1.0                           0    pytorch
cycler                    0.10.0                     py_2    conda-forge
dbus                      1.13.6               h48d8840_2    conda-forge
decorator                 5.0.9              pyhd8ed1ab_0    conda-forge
expat                     2.4.1                h9c3ff4c_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
gettext                   0.19.8.1          h0b5b191_1005    conda-forge
glib                      2.68.3               h9c3ff4c_0    conda-forge
glib-tools                2.68.3               h9c3ff4c_0    conda-forge
greenlet                  1.1.0            py38h709712a_0    conda-forge
gst-plugins-base          1.18.4               hf529b03_2    conda-forge
gstreamer                 1.18.4               h76c114f_2    conda-forge
icu                       68.1                 h58526e2_0    conda-forge
intel-openmp              2021.3.0          h06a4308_3350  
jbig                      2.1               h7f98852_2003    conda-forge
jinja2                    3.0.1              pyhd8ed1ab_0    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
kiwisolver                1.3.1            py38h1fd1430_1    conda-forge
krb5                      1.19.2               hcc1bbae_0    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.35.1               h7274673_9  
lerc                      2.2.1                h9c3ff4c_0    conda-forge
libblas                   3.9.0           11_linux64_openblas    conda-forge
libcblas                  3.9.0           11_linux64_openblas    conda-forge
libclang                  11.1.0          default_ha53f305_1    conda-forge
libdeflate                1.7                  h7f98852_5    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libevent                  2.1.10               hcdb4288_3    conda-forge
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.3.0               h5101ec6_17  
libgfortran-ng            11.1.0               h69a702a_8    conda-forge
libgfortran5              11.1.0               h6c583b3_8    conda-forge
libglib                   2.68.3               h3e27bee_0    conda-forge
libgomp                   9.3.0               h5101ec6_17  
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.9.0           11_linux64_openblas    conda-forge
libllvm11                 11.1.0               hf817b99_2    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.17          pthreads_h8fe5266_1    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     13.3                 hd57d9b9_0    conda-forge
libstdcxx-ng              9.3.0               hd4cf53a_17  
libtiff                   4.3.0                hf544144_1    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp-base              1.2.0                h7f98852_2    conda-forge
libxcb                    1.13              h7f98852_1003    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.12               h72842e0_0    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
markupsafe                2.0.1            py38h497a2fe_0    conda-forge
matplotlib                3.4.2            py38h578d9bd_0    conda-forge
matplotlib-base           3.4.2            py38hcc49a3a_0    conda-forge
mkl                       2021.3.0           h06a4308_520  
mysql-common              8.0.25               ha770c72_2    conda-forge
mysql-libs                8.0.25               hfa10184_2    conda-forge
ncurses                   6.2                  he6710b0_1  
networkx                  2.5                        py_0    conda-forge
ninja                     1.10.2               h4bd325d_0    conda-forge
nspr                      4.30                 h9c3ff4c_0    conda-forge
nss                       3.67                 hb5efdd6_0    conda-forge
numpy                     1.21.1           py38h9894fe3_0    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
openjpeg                  2.4.0                hb52868f_1    conda-forge
openssl                   1.1.1k               h7f98852_0    conda-forge
pandas                    1.3.1            py38h1abd341_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pillow                    8.3.1            py38h8e6f84c_0    conda-forge
pip                       21.2.3             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
pycairo                   1.20.1           py38hf61ee4a_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyqt                      5.12.3           py38h578d9bd_7    conda-forge
pyqt-impl                 5.12.3           py38h7400c14_7    conda-forge
pyqt5-sip                 4.19.18          py38h709712a_7    conda-forge
pyqtchart                 5.12             py38h7400c14_7    conda-forge
pyqtwebengine             5.12.1           py38h7400c14_7    conda-forge
python                    3.8.11          h12debd9_0_cpython  
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytorch                   1.4.0               py3.8_cpu_0  [cpuonly]  pytorch
pytorch_scatter           2.0.4            py38h9235441_1    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
qt                        5.12.9               hda022c4_4    conda-forge
rdkit                     2021.03.4        py38hf8acc3d_0    conda-forge
readline                  8.1                  h27cfd23_0  
reportlab                 3.5.68           py38hadf75a6_0    conda-forge
setuptools                52.0.0           py38h06a4308_0  
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlalchemy                1.4.22           py38h497a2fe_0    conda-forge
sqlite                    3.36.0               hc218d9a_0  
tk                        8.6.10               hbc83047_0  
torchaudio                0.4.0                      py38    pytorch
torchdrug                 0.1.0                  h39ad8c7    milagraph
torchvision               0.5.0                  py38_cpu  [cpuonly]  pytorch
tornado                   6.1              py38h497a2fe_1    conda-forge
tqdm                      4.62.0             pyhd8ed1ab_0    conda-forge
wheel                     0.36.2             pyhd3eb1b0_0  
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.5                h7b6447c_0  
zlib                      1.2.11               h7b6447c_3  
zstd                      1.5.0                ha95c52a_0    conda-forge

Error output

Here is the error:

(torchdrug) 1_Projects $ python
Python 3.8.11 (default, Aug  3 2021, 15:09:35) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torchdrug
Traceback (most recent call last):
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torch_scatter/__init__.py", line 12, in <module>
    torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torch_scatter/_version.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torchdrug/__init__.py", line 1, in <module>
    from . import patch
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torchdrug/patch.py", line 12, in <module>
    from torchdrug import core, data
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torchdrug/core/__init__.py", line 2, in <module>
    from .engine import Engine
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torchdrug/core/engine.py", line 10, in <module>
    from torchdrug import data, core, utils
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torchdrug/data/__init__.py", line 1, in <module>
    from .graph import Graph, PackedGraph, cat
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torchdrug/data/graph.py", line 9, in <module>
    from torch_scatter import scatter_add, scatter_min
  File "/home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torch_scatter/__init__.py", line 21, in <module>
    raise OSError(e)
OSError: /home/murph213/anaconda3/envs/torchdrug/lib/python3.8/site-packages/torch_scatter/_version.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

rmurphy2718 avatar Aug 12 '21 15:08 rmurphy2718

Hi! This means torch_scatter can't load its binary properly. Maybe it's a problem for the torch_scatter from the conda-forge channel.

Could you try to add -c rusty1s before -c conda-forge? This will install torch_scatter from its official channel. If not, you may try manually install torch and torch_scatter using their recommended commands, and then install torchdrug.

KiddoZhu avatar Aug 12 '21 16:08 KiddoZhu

I tried both suggestions and neither worked. (I got a similar error). I also tried building from source, following the instructions:

conda install -c conda-forge rdkit
git clone https://github.com/DeepGraphLearning/torchdrug
cd torchdrug
pip install -r requirements.txt
python setup.py install

I got the error

(td2) torchdrug $ python
Python 3.8.11 (default, Aug  3 2021, 15:09:35) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torchdrug
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/murph213/torchdrug/torchdrug/__init__.py", line 1, in <module>
    from . import patch
  File "/home/murph213/torchdrug/torchdrug/patch.py", line 12, in <module>
    from torchdrug import core, data
  File "/home/murph213/torchdrug/torchdrug/core/__init__.py", line 2, in <module>
    from .engine import Engine
  File "/home/murph213/torchdrug/torchdrug/core/engine.py", line 10, in <module>
    from torchdrug import data, core, utils
  File "/home/murph213/torchdrug/torchdrug/data/__init__.py", line 1, in <module>
    from .graph import Graph, PackedGraph, cat
  File "/home/murph213/torchdrug/torchdrug/data/graph.py", line 11, in <module>
    from torchdrug import core, utils
  File "/home/murph213/torchdrug/torchdrug/utils/__init__.py", line 3, in <module>
    from .torch import load_extension, cpu, cuda, detach, clone, mean, cat, stack, sparse_coo_tensor
  File "/home/murph213/torchdrug/torchdrug/utils/torch.py", line 4, in <module>
    from torch._six import container_abcs
ImportError: cannot import name 'container_abcs' from 'torch._six' (/home/murph213/anaconda3/envs/td2/lib/python3.8/site-packages/torch/_six.py)

I am happy to try either the source or conda solution; which do you think is more stable? If conda, could you provide which instructions you think are most likely to work and we can try from there? Thank you.

Edit: for instance, maybe you can share your python version and the installation steps you followed? That would be very helpful :). I am using the CPU installation, by the way.

rmurphy2718 avatar Aug 12 '21 17:08 rmurphy2718

I thought that maybe using LTS PyTorch would help, so I tried

conda create -n torchdrug9 python=3.8
conda activate torchdrug9

conda install numpy
conda install pytorch torchvision torchaudio cpuonly -c pytorch-lts
conda install -c milagraph -c conda-forge torchdrug

but I got a different error:

>>> import torchdrug
Traceback (most recent call last):
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torch_scatter/__init__.py", line 12, in <module>
    torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torch/_ops.py", line 104, in load_library
    ctypes.CDLL(path)
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torch_scatter/_version.so: undefined symbol: _ZN3c1017RegisterOperatorsC1Ev

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torchdrug/__init__.py", line 1, in <module>
    from . import patch
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torchdrug/patch.py", line 12, in <module>
    from torchdrug import core, data
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torchdrug/core/__init__.py", line 2, in <module>
    from .engine import Engine
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torchdrug/core/engine.py", line 10, in <module>
    from torchdrug import data, core, utils
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torchdrug/data/__init__.py", line 1, in <module>
    from .graph import Graph, PackedGraph, cat
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torchdrug/data/graph.py", line 9, in <module>
    from torch_scatter import scatter_add, scatter_min
  File "/home/murph213/anaconda3/envs/torchdrug9/lib/python3.8/site-packages/torch_scatter/__init__.py", line 18, in <module>
    raise RuntimeError(
RuntimeError: Expected PyTorch version 1.4 but found version 1.8

Similarly for

conda install -c milagraph -c rusty1s -c conda-forge torchdrug

rmurphy2718 avatar Aug 12 '21 18:08 rmurphy2718

I finally got an installation that works. I think the key points were to be careful to use the supported version of PyTorch, install the correct torch-scatter for that PyTorch version, and to build from source using pip (within conda). Below are my steps for my CPU install.

conda create -n td_test python=3.8

pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html

# From https://github.com/rusty1s/pytorch_scatter
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cpu.html

conda install -c conda-forge rdkit

mkdir ~/torch_drug_test

git clone https://github.com/DeepGraphLearning/torchdrug

cd torchdrug

Then, istall the other packages in requirements.txt (but torch and torch-scatter are already installed). Next,

python setup.py install

Also, this happened to make it hard to use Jupyter Lab, so I followed these steps:

conda install -c conda-forge jupyterlab
conda install ipykernel
ipython kernel install --user

from https://stackoverflow.com/questions/53004311/how-to-add-conda-environment-to-jupyter-lab

rmurphy2718 avatar Aug 12 '21 20:08 rmurphy2718

For the import 'container_abcs' error, please refer to #4.

shichence avatar Aug 13 '21 06:08 shichence

I finally got an installation that works. I think the key points were to be careful to use the supported version of PyTorch, install the correct torch-scatter for that PyTorch version, and to build from source using pip (within conda). Below are my steps for my CPU install.

conda create -n td_test python=3.8

pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html

# From https://github.com/rusty1s/pytorch_scatter
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cpu.html

conda install -c conda-forge rdkit

mkdir ~/torch_drug_test

git clone https://github.com/DeepGraphLearning/torchdrug

cd torchdrug

Then, istall the other packages in requirements.txt (but torch and torch-scatter are already installed). Next,

python setup.py install

Also, this happened to make it hard to use Jupyter Lab, so I followed these steps:

conda install -c conda-forge jupyterlab
conda install ipykernel
ipython kernel install --user

from https://stackoverflow.com/questions/53004311/how-to-add-conda-environment-to-jupyter-lab

Thank u

yrq3027 avatar Aug 25 '21 09:08 yrq3027