divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.87k stars 283 forks source link

Problems while running the threedgraph.ipynb - AttributeError #49

Closed smoes-prime closed 3 years ago

smoes-prime commented 3 years ago

I installed DIG and then cloned the repo locally, I tried to run the three3graph.ipynb tutorial as is, but it threw an error on line 4, which reads as follows model = SphereNet(energy_and_force=False, cutoff=5.0, num_layers=4, hidden_channels=128, out_channels=1, int_emb_size=64, basis_emb_size_dist=8, basis_emb_size_angle=8, basis_emb_size_torsion=8, out_emb_channels=256, num_spherical=3, num_radial=6, envelope_exponent=5, num_before_skip=1, num_after_skip=2, num_output_layers=3, use_node_features=True ) loss_func = torch.nn.L1Loss() evaluation = ThreeDEvaluator()

the error I get is:


AttributeError Traceback (most recent call last)

in 4 num_spherical=3, num_radial=6, envelope_exponent=5, 5 num_before_skip=1, num_after_skip=2, num_output_layers=3, ----> 6 use_node_features=True 7 ) 8 loss_func = torch.nn.L1Loss() ~/.local/lib/python3.6/site-packages/dig/threedgraph/method/spherenet/spherenet.py in __init__(self, energy_and_force, cutoff, num_layers, hidden_channels, out_channels, int_emb_size, basis_emb_size_dist, basis_emb_size_angle, basis_emb_size_torsion, out_emb_channels, num_spherical, num_radial, envelope_exponent, num_before_skip, num_after_skip, num_output_layers, act, output_init, use_node_features) 263 self.init_v = update_v(hidden_channels, out_emb_channels, out_channels, num_output_layers, act, output_init) 264 self.init_u = update_u() --> 265 self.emb = emb(num_spherical, num_radial, self.cutoff, envelope_exponent) 266 267 self.update_vs = torch.nn.ModuleList([ ~/.local/lib/python3.6/site-packages/dig/threedgraph/method/spherenet/spherenet.py in __init__(self, num_spherical, num_radial, cutoff, envelope_exponent) 22 super(emb, self).__init__() 23 self.dist_emb = dist_emb(num_radial, cutoff, envelope_exponent) ---> 24 self.angle_emb = angle_emb(num_spherical, num_radial, cutoff, envelope_exponent) 25 self.torsion_emb = torsion_emb(num_spherical, num_radial, cutoff, envelope_exponent) 26 self.reset_parameters() ~/.local/lib/python3.6/site-packages/dig/threedgraph/method/spherenet/features.py in __init__(self, num_spherical, num_radial, cutoff, envelope_exponent) 196 # self.envelope = Envelope(envelope_exponent) 197 --> 198 bessel_forms = bessel_basis(num_spherical, num_radial) 199 sph_harm_forms = real_sph_harm(num_spherical) 200 self.sph_funcs = [] ~/.local/lib/python3.6/site-packages/dig/threedgraph/method/spherenet/features.py in bessel_basis(n, k) 56 normalizer += [normalizer_tmp] 57 ---> 58 f = spherical_bessel_formulas(n) 59 x = sym.Symbol('x') 60 bess_basis = [] ~/.local/lib/python3.6/site-packages/dig/threedgraph/method/spherenet/features.py in spherical_bessel_formulas(n) 35 36 def spherical_bessel_formulas(n): ---> 37 x = sym.Symbol('x') 38 39 f = [sym.sin(x) / x] AttributeError: 'NoneType' object has no attribute 'symbols' Now I did try a solution which was changing the sym.symbols('x') to sym.Symbol('x'), which is the correct usage according to the SymPy page. However this doesn't solve the problem and gives the exact same error on the same line. I'm running on a linux pod using docker and kubernetes, other notebooks from the DIG tutorials have worked. Pytorch 1.8.0 Python 3.6 PyG 2.0.1 #91-Ubuntu SMP 5.4.0-81-generic
limei0307 commented 3 years ago

Hi,

Thanks for your interest in our library!

I can reproduce this issue. Please try 'pip install sympy' to install sympy firstly.

Thanks

smoes-prime commented 3 years ago

I have installed sympy via pip and the same error message appears, I've also tried import sympy as sym, and from sympy import *, and just simply import sympy.

smoes-prime commented 3 years ago

I just realized an error I made earlier, I am not on pytorch 1.8, but rather 1.7.1 since I have CUDA 10.1 Other than that the system info is accurate.

limei0307 commented 3 years ago

Hi,

Could you please provide all your package?

Thanks

limei0307 commented 3 years ago

Hi,

I can reproduce this issue on PyTorch 1.7.1 and solve it by installing sympy.

And I think if you have PyTorch < 1.8.0, you need to install torch-geometric via Pip Wheels or from source.

Here is my package list on Pytorch 1.7.1, Python 3.6, torch-geometric 2.0.1:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             4.5                       1_gnu  
absl-py                   0.14.0                   pypi_0    pypi
argon2-cffi               21.1.0                   pypi_0    pypi
async-generator           1.10                     pypi_0    pypi
attrs                     21.2.0                   pypi_0    pypi
backcall                  0.2.0                    pypi_0    pypi
blas                      1.0                         mkl  
bleach                    4.1.0                    pypi_0    pypi
ca-certificates           2021.7.5             h06a4308_1  
cachetools                4.2.2                    pypi_0    pypi
captum                    0.2.0                    pypi_0    pypi
certifi                   2021.5.30        py36h06a4308_0  
cffi                      1.14.6                   pypi_0    pypi
charset-normalizer        2.0.6                    pypi_0    pypi
cilog                     1.2.0                    pypi_0    pypi
cloudpickle               2.0.0                    pypi_0    pypi
cudatoolkit               10.1.243             h6bb024c_0  
cycler                    0.10.0                   pypi_0    pypi
dataclasses               0.8                pyh4f3eec9_6  
decorator                 4.4.2                    pypi_0    pypi
defusedxml                0.7.1                    pypi_0    pypi
dive-into-graphs          0.1.1                    pypi_0    pypi
entrypoints               0.3                      pypi_0    pypi
et-xmlfile                1.1.0                    pypi_0    pypi
freetype                  2.10.4               h5ab3b9f_0  
google-auth               1.35.0                   pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
googledrivedownloader     0.4                      pypi_0    pypi
grpcio                    1.40.0                   pypi_0    pypi
idna                      3.2                      pypi_0    pypi
importlib-metadata        4.8.1                    pypi_0    pypi
intel-openmp              2021.3.0          h06a4308_3350  
ipykernel                 5.5.5                    pypi_0    pypi
ipython                   7.16.1                   pypi_0    pypi
ipython-genutils          0.2.0                    pypi_0    pypi
ipywidgets                7.6.5                    pypi_0    pypi
isodate                   0.6.0                    pypi_0    pypi
jedi                      0.18.0                   pypi_0    pypi
jinja2                    3.0.1                    pypi_0    pypi
joblib                    1.0.1                    pypi_0    pypi
jpeg                      9b                   h024ee3a_2  
jsonschema                3.2.0                    pypi_0    pypi
jupyter                   1.0.0                    pypi_0    pypi
jupyter-client            7.0.3                    pypi_0    pypi
jupyter-console           6.4.0                    pypi_0    pypi
jupyter-core              4.8.1                    pypi_0    pypi
jupyterlab-pygments       0.1.2                    pypi_0    pypi
jupyterlab-widgets        1.0.2                    pypi_0    pypi
kiwisolver                1.3.1                    pypi_0    pypi
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  
libgomp                   9.3.0               h5101ec6_17  
libpng                    1.6.37               hbc83047_0  
libstdcxx-ng              9.3.0               hd4cf53a_17  
libtiff                   4.2.0                h85742a9_0  
libuv                     1.40.0               h7b6447c_0  
libwebp-base              1.2.0                h27cfd23_0  
llvmlite                  0.36.0                   pypi_0    pypi
lz4-c                     1.9.3                h295c915_1  
markdown                  3.3.4                    pypi_0    pypi
markupsafe                2.0.1                    pypi_0    pypi
matplotlib                3.3.4                    pypi_0    pypi
mistune                   0.8.4                    pypi_0    pypi
mkl                       2020.2                      256  
mkl-service               2.3.0            py36he8ac12f_0  
mkl_fft                   1.3.0            py36h54f3939_0  
mkl_random                1.1.1            py36h0573a6f_0  
mpmath                    1.2.1                    pypi_0    pypi
mypy-extensions           0.4.3                    pypi_0    pypi
nbclient                  0.5.4                    pypi_0    pypi
nbconvert                 6.0.7                    pypi_0    pypi
nbformat                  5.1.3                    pypi_0    pypi
ncurses                   6.2                  he6710b0_1  
nest-asyncio              1.5.1                    pypi_0    pypi
networkx                  2.5.1                    pypi_0    pypi
ninja                     1.10.2               hff7bd54_1  
notebook                  6.4.4                    pypi_0    pypi
numba                     0.53.1                   pypi_0    pypi
numpy                     1.19.2           py36h54aff64_0  
numpy-base                1.19.2           py36hfa32c7d_0  
oauthlib                  3.1.1                    pypi_0    pypi
olefile                   0.46                     py36_0  
openjpeg                  2.4.0                h3ad879b_0  
openpyxl                  3.0.9                    pypi_0    pypi
openssl                   1.1.1l               h7f8727e_0  
packaging                 21.0                     pypi_0    pypi
pandas                    1.1.5                    pypi_0    pypi
pandocfilters             1.5.0                    pypi_0    pypi
parso                     0.8.2                    pypi_0    pypi
pexpect                   4.8.0                    pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pillow                    8.3.1            py36h2c7a002_0  
pip                       21.0.1           py36h06a4308_0  
prometheus-client         0.11.0                   pypi_0    pypi
prompt-toolkit            3.0.20                   pypi_0    pypi
protobuf                  3.18.0                   pypi_0    pypi
ptyprocess                0.7.0                    pypi_0    pypi
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
pycparser                 2.20                     pypi_0    pypi
pygments                  2.10.0                   pypi_0    pypi
pyparsing                 2.4.7                    pypi_0    pypi
pyrsistent                0.18.0                   pypi_0    pypi
python                    3.6.13               h12debd9_1  
python-dateutil           2.8.2                    pypi_0    pypi
pytorch                   1.7.1           py3.6_cuda10.1.243_cudnn7.6.3_0    pytorch
pytz                      2021.1                   pypi_0    pypi
pyyaml                    5.4.1                    pypi_0    pypi
pyzmq                     22.3.0                   pypi_0    pypi
qtconsole                 5.1.1                    pypi_0    pypi
qtpy                      1.11.2                   pypi_0    pypi
rdflib                    5.0.0                    pypi_0    pypi
rdkit-pypi                2021.3.5.1               pypi_0    pypi
readline                  8.1                  h27cfd23_0  
requests                  2.26.0                   pypi_0    pypi
requests-oauthlib         1.3.0                    pypi_0    pypi
rsa                       4.7.2                    pypi_0    pypi
scikit-learn              0.24.2                   pypi_0    pypi
scipy                     1.5.4                    pypi_0    pypi
send2trash                1.8.0                    pypi_0    pypi
setuptools                58.0.4           py36h06a4308_0  
shap                      0.39.0                   pypi_0    pypi
six                       1.16.0             pyhd3eb1b0_0  
slicer                    0.0.7                    pypi_0    pypi
sqlite                    3.36.0               hc218d9a_0  
sympy                     1.8                      pypi_0    pypi
tabulate                  0.8.9                    pypi_0    pypi
tensorboard               2.6.0                    pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-wit    1.8.0                    pypi_0    pypi
terminado                 0.12.1                   pypi_0    pypi
testpath                  0.5.0                    pypi_0    pypi
threadpoolctl             2.2.0                    pypi_0    pypi
tk                        8.6.10               hbc83047_0  
torch-cluster             1.5.9                    pypi_0    pypi
torch-geometric           2.0.1                    pypi_0    pypi
torch-scatter             2.0.7                    pypi_0    pypi
torch-sparse              0.6.9                    pypi_0    pypi
torch-spline-conv         1.2.1                    pypi_0    pypi
torchaudio                0.7.2                      py36    pytorch
torchvision               0.8.2                py36_cu101    pytorch
tornado                   6.1                      pypi_0    pypi
tqdm                      4.62.3                   pypi_0    pypi
traitlets                 4.3.3                    pypi_0    pypi
typed-argument-parser     1.5.4                    pypi_0    pypi
typing-inspect            0.7.1                    pypi_0    pypi
typing_extensions         3.10.0.2           pyh06a4308_0  
urllib3                   1.26.7                   pypi_0    pypi
wcwidth                   0.2.5                    pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
werkzeug                  2.0.1                    pypi_0    pypi
wheel                     0.37.0             pyhd3eb1b0_1  
widgetsnbextension        3.5.1                    pypi_0    pypi
xz                        5.2.5                h7b6447c_0  
yacs                      0.1.8                    pypi_0    pypi
zipp                      3.5.0                    pypi_0    pypi
zlib                      1.2.11               h7b6447c_3  
zstd                      1.4.9                haebb681_0 

Thanks

limei0307 commented 3 years ago

Hi @smoes-prime,

Are you still having this issue?

Thanks

smoes-prime commented 3 years ago

I solved it by simply updating my pytorch and PyG version when my sysadmin updated my pod.