isayevlab / Auto3D_pkg

Auto3D generates low-energy conformers from SMILES/SDF
MIT License
146 stars 32 forks source link

NameError: name 'ANI2xt' is not defined #79

Closed PatWalters closed 4 months ago

PatWalters commented 4 months ago

When I try to run the tautomers example notebook, I get the exception below. Is there a workaround?

Traceback (most recent call last):
  File "/home/pwalters/anaconda3/envs/rdkit_2023_03/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/home/pwalters/anaconda3/envs/rdkit_2023_03/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pwalters/anaconda3/envs/rdkit_2023_03/lib/python3.10/site-packages/Auto3D/auto3D.py", line 140, in optim_rank_wrapper
    optimizer = optimizing(enumerated_sdf, optimized_og,
  File "/home/pwalters/anaconda3/envs/rdkit_2023_03/lib/python3.10/site-packages/Auto3D/batch_opt/batchopt.py", line 399, in __init__
    self.ani = ANI2xt(device)
NameError: name 'ANI2xt' is not defined
LiuCMU commented 4 months ago

Hey Pat! Are you using auto3d version 2.2.11?

PatWalters commented 4 months ago

I'm using 2.2.11, just installed from GitHub. Do I need to conda install -c conda-forge torchani to get ANI2xt?

btw, thanks for the quick response Jack!

LiuCMU commented 4 months ago

Thanks for letting us know the issue, too.

Just to check if it's related to ANI2xt only: If you change optimizing_engine="ANI2xt" to optimizing_engine="AIMNET", does it throw you an error message too?

The best way to install auto3d is via pip: pip install auto3d --upgrade. Could you please try to uninstall the current auto3d, then reinstall the via pip?

PatWalters commented 4 months ago

If I use optimizing_engine="AIMNET" it works.

I reinstalled with pip and got the same error

Process Process-5:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/.local/lib/python3.9/site-packages/Auto3D/auto3D.py", line 140, in optim_rank_wrapper
    optimizer = optimizing(enumerated_sdf, optimized_og,
  File "/home/ubuntu/.local/lib/python3.9/site-packages/Auto3D/batch_opt/batchopt.py", line 399, in __init__
    self.ani = ANI2xt(device)
NameError: name 'ANI2xt' is not defined
PatWalters commented 4 months ago

I tried the commandline interface and got the same error

python ../tauto_interface.py files/sildnafil.smi --k=1 --enumerate_tautomer=True --tauto_engine="rdkit" --max_confs=10 --patience=200 --use_gpu=False --tauto_k=1
Optimizing on job1
Process Process-5:
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/auto3D/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/home/ubuntu/anaconda3/envs/auto3D/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/anaconda3/envs/auto3D/lib/python3.12/site-packages/Auto3D/auto3D.py", line 140, in optim_rank_wrapper
    optimizer = optimizing(enumerated_sdf, optimized_og,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/anaconda3/envs/auto3D/lib/python3.12/site-packages/Auto3D/batch_opt/batchopt.py", line 399, in __init__
    self.ani = ANI2xt(device)
               ^^^^^^
NameError: name 'ANI2xt' is not defined
LiuCMU commented 4 months ago

Thanks for the detailed error information. It's expected that the command line interface (CLI) returned the same error, because CLI calls the same python functions under the hood. Since it works with AIMNET, then it's just an issue of part of the package.

Could you try to use ANI2xt to do SPE calculation? The notebook is available here. To use ANI2xt, just change `model_name="ANI2xt" in the notebook. I want to see if all functions related to ANI2xt are affected.

Sorry that I have to rely on you for these tests. I tried to run the tautomer notebook using Linux and Mac, but both returned the results normally.

Besides, could you share some information about your system (Windows or Linux, output from conda list)? Based on the error information, it feels like ANI2xt module was not imported for the optimizer. Thanks!

PatWalters commented 4 months ago

Based on the docs it looks like TorchANI has to be installed for ANI2xt to work. Is this the case?

image

LiuCMU commented 4 months ago

yeap

PatWalters commented 4 months ago

That did the trick! Sorry, I need to do a better job of Reading The Friendly Manual

LiuCMU commented 4 months ago

Great! Let me know if you have any feedback😁 I will close this issue for now.