Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load toolkit 'OpenEye Toolkit' with openeye-toolkit installed and OE_LICENSE set up #825

Closed
mieczyslaw opened this issue Jan 28, 2021 · 7 comments · Fixed by #850

Comments

@mieczyslaw
Copy link

Describe the bug
I installed openeye-toolkits 2020.2.0 from conda openeye channel. I set up OE_LICENSE (for OEChem) and run openeye-toolkits integration tests to see that they pass for OEChem (and skip for other parts). The licence is fine as without setting up OE_LICENSE, OpenFF shows "LICENSE: N.B. OE_LICENSE environment variable is not set".

However, when trying to parametrize molecule with OpenFF using OEChem, as suggested to sort out RDKit issues (see script1 in #822) , I still see: Warning: Unable to load toolkit 'OpenEye Toolkit'.

To Reproduce
Call script1.py from #822 with openeye-toolkits installed and OE_LICENSE for OEChem set up.

Output
Warning: Unable to load toolkit 'OpenEye Toolkit'. RDKit is still in use (and crashes as in #822).

Computing environment (please complete the following information):

  • Operating system: Linux Red Hat
  • Output of running conda list
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
acpype                    2020.10.24.12.16            py_0    conda-forge
amberlite                 16.0                     pypi_0    pypi
ambertools                20.9                     pypi_0    pypi
apbs                      1.5                  h14c3975_3    schrodinger
argh                      0.26.2          pyh9f0ad1d_1002    conda-forge
argon2-cffi               20.1.0           py37h4abf009_2    conda-forge
arpack                    3.7.0                h236a147_2    conda-forge
astunparse                1.6.2                      py_0    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     20.3.0             pyhd3deb0d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.1                      py_0    conda-forge
biopython                 1.78             py37h4abf009_1    conda-forge
biosimspace               2020.1.0        py37h14c3975_95    michellab/label/dev
bleach                    3.2.1              pyh9f0ad1d_0    conda-forge
blosc                     1.21.0               h9c3ff4c_0    conda-forge
boost                     1.72.0           py37h48f8a5e_1    conda-forge
boost-cpp                 1.72.0               h9359b55_3    conda-forge
brotlipy                  0.7.0           py37hb5d75c8_1001    conda-forge
bson                      0.5.9                      py_0    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.17.1               h36c2ea0_0    conda-forge
ca-certificates           2021.1.19            h06a4308_0  
cached-property           1.5.1                      py_0    conda-forge
cairo                     1.16.0            h9f066cc_1006    conda-forge
certifi                   2020.12.5        py37h06a4308_0  
cffi                      1.14.4           py37h11fe52a_0    conda-forge
cftime                    1.3.0            py37ha21ca33_0    conda-forge
chardet                   4.0.0            py37h89c1867_1    conda-forge
configargparse            1.2.3              pyh9f0ad1d_0    conda-forge
cryptography              3.3.1            py37h7f0c10b_1    conda-forge
curl                      7.71.1               he644dc0_8    conda-forge
cycler                    0.10.0                     py_2    conda-forge
cython                    0.29.21          py37hcd2ae1e_2    conda-forge
dbus                      1.13.6               hfdff14a_1    conda-forge
decorator                 4.4.2                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
expat                     2.2.9                he1b5a44_2    conda-forge
fftw                      3.3.8           nompi_h8cb7ab2_1114    conda-forge
fftw3f                    3.3.4                         2    omnia
fontconfig                2.13.1            h7e3eb15_1002    conda-forge
freemol                   1.158                      py_2    schrodinger
freetype                  2.10.4               h7ca028e_0    conda-forge
gettext                   0.19.8.1          hf34092f_1004    conda-forge
git                       2.30.0          pl5320h014a29a_0    conda-forge
git-lfs                   2.13.1               ha770c72_0    conda-forge
glew                      2.0.0                         0    schrodinger
glib                      2.66.3               h58526e2_0    conda-forge
griddataformats           0.5.0                      py_0    conda-forge
gsd                       2.4.0            py37ha21ca33_0    conda-forge
gsl                       2.6                  he838d99_1    conda-forge
gst-plugins-base          1.14.5               h0935bb2_2    conda-forge
gstreamer                 1.14.5               h36ae1b5_2    conda-forge
h5py                      3.1.0           nompi_py37h1e651dc_100    conda-forge
hdf4                      4.2.13            h10796ff_1004    conda-forge
hdf5                      1.10.6          nompi_h6a2412b_1114    conda-forge
icu                       67.1                 he1b5a44_0    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
importlib-metadata        3.4.0            py37h89c1867_0    conda-forge
importlib_metadata        3.4.0                hd8ed1ab_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipykernel                 5.4.2            py37h888b3d9_0    conda-forge
ipython                   7.19.0           py37h888b3d9_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.6.3              pyhd3deb0d_0    conda-forge
jedi                      0.18.0           py37h89c1867_2    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
joblib                    1.0.0              pyhd8ed1ab_0    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
jsonschema                3.2.0                      py_2    conda-forge
jupyter_client            6.1.11             pyhd8ed1ab_1    conda-forge
jupyter_core              4.7.0            py37h89c1867_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_widgets        1.0.0              pyhd8ed1ab_1    conda-forge
kiwisolver                1.3.1            py37h2527ec5_1    conda-forge
krb5                      1.17.2               h926e7f8_0    conda-forge
lcms2                     2.11                 hcbb858e_1    conda-forge
ld_impl_linux-64          2.35.1               hea4e1c9_1    conda-forge
libblas                   3.9.0                7_openblas    conda-forge
libcblas                  3.9.0                7_openblas    conda-forge
libclang                  10.0.1          default_hde54327_1    conda-forge
libcurl                   7.71.1               hcdd3856_8    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               hcdb4288_3    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc                    7.2.0                h69d50b8_2    conda-forge
libgcc-ng                 9.3.0               h5dbcf3e_17    conda-forge
libgfortran-ng            9.3.0               he4bcb1c_17    conda-forge
libgfortran5              9.3.0               he4bcb1c_17    conda-forge
libglib                   2.66.3               hbe7bbb4_0    conda-forge
libglu                    9.0.0             he1b5a44_1001    conda-forge
libgomp                   9.3.0               h5dbcf3e_17    conda-forge
libholoplaycore           0.1.0_rc4                     1    schrodinger
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.9.0                7_openblas    conda-forge
libllvm10                 10.0.1               he513fc3_3    conda-forge
libnetcdf                 4.7.4           nompi_h56d31a8_107    conda-forge
libnghttp2                1.41.0               h8cfc5f6_2    conda-forge
libopenblas               0.3.12          pthreads_h4812303_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     12.3                 h255efa7_3    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libssh2                   1.9.0                hab1572f_5    conda-forge
libstdcxx-ng              9.3.0               h2ae2ef3_17    conda-forge
libtiff                   4.2.0                hdc55705_0    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libwebp-base              1.1.0                h36c2ea0_3    conda-forge
libxcb                    1.13              h7f98852_1003    conda-forge
libxkbcommon              0.10.0               he1b5a44_0    conda-forge
libxml2                   2.9.10               h68273f3_2    conda-forge
lz4-c                     1.9.3                h9c3ff4c_0    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mako                      1.1.3              pyh9f0ad1d_0    conda-forge
markdown                  3.3.3              pyh9f0ad1d_0    conda-forge
markupsafe                1.1.1            py37h5e8e339_3    conda-forge
matplotlib-base           3.3.3            py37h4f6019d_0    conda-forge
mdanalysis                1.0.0            py37h745909e_1    conda-forge
mdtraj                    1.9.5            py37h113d463_0    conda-forge
mengine                   1                    h14c3975_1    schrodinger
mistune                   0.8.4           py37h5e8e339_1003    conda-forge
mmpbsa-py                 16.0                     pypi_0    pypi
mmtf-python               1.1.2                      py_0    conda-forge
mock                      4.0.3            py37h89c1867_1    conda-forge
more-itertools            8.6.0              pyhd8ed1ab_0    conda-forge
mpeg_encode               1                    h14c3975_1    schrodinger
msgpack-python            1.0.2            py37h2527ec5_1    conda-forge
mtz2ccp4_px               1.0                           1    schrodinger
mysql-common              8.0.21                        2    conda-forge
mysql-libs                8.0.21               hf3661c5_2    conda-forge
nbclient                  0.5.1                      py_0    conda-forge
nbconvert                 6.0.7            py37h89c1867_3    conda-forge
nbformat                  5.0.8                      py_0    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
nest-asyncio              1.4.3              pyhd8ed1ab_0    conda-forge
netcdf-fortran            4.5.3           nompi_h1a0d97b_101    conda-forge
netcdf4                   1.5.3           nompi_py37hdc49583_105    conda-forge
networkx                  2.5                        py_0    conda-forge
nglview                   2.7.7              pyh5ca1d4c_1    conda-forge
notebook                  6.1.6            py37h89c1867_0    conda-forge
nspr                      4.29                 h9c3ff4c_1    conda-forge
nss                       3.60                 hb5efdd6_0    conda-forge
numexpr                   2.7.2            py37hdc94413_0    conda-forge
numpy                     1.19.5           py37haa41c4c_1    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
openbabel                 3.1.1            py37h200e996_1    conda-forge
openblas                  0.3.12          pthreads_h04b7a96_1    conda-forge
openeye-toolkits          2020.2.0                 py37_0    openeye
openforcefield            0.8.3              pyh39e3cac_0    omnia
openforcefields           1.3.0                      py_0    omnia
openmm                    7.4.2           py37_cuda101_rc_1    omnia
openssl                   1.1.1i               h27cfd23_0  
packaging                 20.8               pyhd3deb0d_0    conda-forge
packmol-memgen            1.1.0rc0                 pypi_0    pypi
pandas                    1.2.0            py37hdc94413_0    conda-forge
pandoc                    2.11.3.2             h7f98852_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parmed                    at20RC5+54.g5702a232fe.dirty          pypi_0    pypi
parso                     0.8.1              pyhd8ed1ab_0    conda-forge
patsy                     0.5.1                      py_0    conda-forge
pcre                      8.44                 he1b5a44_0    conda-forge
pdb2pqr                   2.1.2+pymol                py_0    schrodinger
pdb4amber                 1.7.dev0                 pypi_0    pypi
pdoc3                     0.8.1                      py_0    conda-forge
perl                      5.32.0               h36c2ea0_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    8.1.0            py37he6b4880_1    conda-forge
pip                       20.3.3             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
pluggy                    0.13.1           py37h89c1867_4    conda-forge
pmw                       2.0.1+3                    py_3    schrodinger
prometheus_client         0.9.0              pyhd3deb0d_0    conda-forge
prompt-toolkit            3.0.10             pyha770c72_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
py                        1.10.0             pyhd3deb0d_0    conda-forge
pycairo                   1.20.0           py37h01af8b0_1    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pygments                  2.7.3              pyhd8ed1ab_0    conda-forge
pygtail                   0.11.1                     py_0    conda-forge
pymbar                    3.0.5            py37ha21ca33_1    conda-forge
pymol                     2.4.1            py37h913975d_0    schrodinger
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pypdb                     2.0                pyhd8ed1ab_0    conda-forge
pyqt                      5.12.3           py37h8685d9f_3    conda-forge
pyqt5-sip                 4.19.18                  pypi_0    pypi
pyqtchart                 5.12                     pypi_0    pypi
pyqtwebengine             5.12.1                   pypi_0    pypi
pyrsistent                0.17.3           py37h5e8e339_2    conda-forge
pysocks                   1.7.1            py37h89c1867_3    conda-forge
pytables                  3.6.1            py37h0c4f3e0_3    conda-forge
pytest                    6.2.1            py37h89c1867_1    conda-forge
python                    3.7.8           h8bdb77d_2_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pytraj                    2.0.5                    pypi_0    pypi
pytz                      2020.5             pyhd8ed1ab_0    conda-forge
pyyaml                    5.3.1            py37h5e8e339_2    conda-forge
pyzmq                     20.0.0           py37h499b945_1    conda-forge
qt                        5.12.5               h7400415_4    conda-forge
rdkit                     2020.09.3        py37h400b6df_0    conda-forge
readline                  8.0                  he28a2e2_2    conda-forge
reportlab                 3.5.59           py37h69800bb_0    conda-forge
requests                  2.25.1             pyhd3deb0d_0    conda-forge
rigimol                   1.3                           2    schrodinger
sander                    16.0                     pypi_0    pypi
scikit-learn              0.24.0           py37h69acf81_0    conda-forge
scipy                     1.6.0            py37h14a347d_0    conda-forge
scripttest                1.3                      pypi_0    pypi
seaborn                   0.11.1               ha770c72_0    conda-forge
seaborn-base              0.11.1             pyhd8ed1ab_0    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                49.6.0           py37h89c1867_3    conda-forge
sire                      2020.1.0        py37hf484d3e_72    michellab/label/dev
six                       1.15.0             pyh9f0ad1d_0    conda-forge
smirnoff99frosst          1.1.0                      py_2    omnia
snappy                    1.1.8                he1b5a44_3    conda-forge
sqlalchemy                1.3.22           py37h5e8e339_1    conda-forge
sqlite                    3.34.0               h74cdb3f_0    conda-forge
statsmodels               0.12.1           py37h902c9e0_2    conda-forge
tbb                       2019.9               hc9558a2_1    conda-forge
tbb-devel                 2019.9               hc9558a2_1    conda-forge
terminado                 0.9.2            py37h89c1867_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
threadpoolctl             2.1.0              pyh5ca1d4c_0    conda-forge
tk                        8.6.10               h21135ba_1    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tornado                   6.1              py37h5e8e339_1    conda-forge
tqdm                      4.55.1             pyhd3eb1b0_0  
traitlets                 5.0.5                      py_0    conda-forge
typing_extensions         3.7.4.3                    py_0    conda-forge
urllib3                   1.26.2             pyhd8ed1ab_0    conda-forge
watchdog                  1.0.2            py37h89c1867_1    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
widgetsnbextension        3.5.1            py37h89c1867_4    conda-forge
xmltodict                 0.12.0                     py_0    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h516909a_0    conda-forge
xorg-libsm                1.2.3             h84519dc_1000    conda-forge
xorg-libx11               1.6.12               h516909a_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                h516909a_0    conda-forge
xorg-libxrender           0.9.10            h516909a_1002    conda-forge
xorg-libxt                1.2.0                h516909a_0    conda-forge
xorg-renderproto          0.11.1            h14c3975_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                h516909a_1    conda-forge
yaml                      0.2.5                h516909a_0    conda-forge
zeromq                    4.3.3                h58526e2_3    conda-forge
zipp                      3.4.0                      py_0    conda-forge
zlib                      1.2.11            h516909a_1010    conda-forge
zstd                      1.4.8                ha95c52a_1    conda-forge

Additional context
I assume that OEChem is automatically loaded and takes precedence over RDKit.

@mieczyslaw
Copy link
Author

@mattwthompson using your suggestion to move to OEChem, decided to create a separate ticket

@mieczyslaw
Copy link
Author

mieczyslaw commented Jan 28, 2021

When modifying script2 in #822 to use OpenEyeToolkitWrapper:

from openforcefield.utils.toolkits import OpenEyeToolkitWrapper
toolkit_wrapper = OpenEyeToolkitWrapper()

I see:

/lib/python3.7/site-packages/openforcefield/utils/toolkits.py", line 603, in __init__
    raise LicenseError(msg)
openforcefield.utils.toolkits.LicenseError: The required toolkit OpenEye Toolkit is not available. The OpenEye toolkit requires a (free for academics) license, and can be found at: https://docs.eyesopen.com/toolkits/python/quickstart-python/install.html

How is it possible that OE toolkit integration tests work fine for OEChem with the licence, but OpenFF raises LicenseError? What kind of error it could be?

Also when using toolkit code:

from openeye import oechem

expdate = oechem.OEUIntArray(3)

if oechem.OEChemIsLicensed("python", expdate):
    oechem.OEThrow.Info("License expires: day: %d  month: %d year: %d" % (expdate[0], expdate[1], expdate[2]))

I get: License expires: day: 1 month: 4 year: 2021, therefore a licence is visible to the toolkit.

@mattwthompson
Copy link
Member

The code currently assumes you have each of the OpenEye toolkits we use installed, and provides a not-very-helpful error message if one of them is not found (even if the one you want to use is found). Besides OEChem, you're missing OEQuacPac, OEIUPAC, and OEOmega.

Apologies again for the not-so-descriptive error message, and thanks for the feedback! I believe this is an oversight that we can fix for future releases.

@mieczyslaw
Copy link
Author

mieczyslaw commented Jan 28, 2021

My licence is for OEChem only. Does it mean that I can't use the toolkit at all (to read PDB as a replacement for RDKit as in script2 or implicitly replaced as in offtop examples) because I don't have licences for OEQuacPac, OEIUPAC, and OEOmega?

How to make offtop example (script1) to use OEChem instead of RDKit?

@j-wags
Copy link
Member

j-wags commented Jan 28, 2021

Oh, this is really interesting. Thanks for writing in about this @mieczyslaw.

My licence is for OEChem only. Does it mean that I can't use the toolkit at all (to read PDB as a replacement for RDKit as in script2 or implicitly replaced as in offtop examples) because I don't have licences for OEQuacPac, OEIUPAC, and OEOmega?

Unfortunately, this is an aspect of the design that we hadn't considered before, so that is currently the case. I'll go ahead and do two things ASAP:

  1. Try to provide you a workaround so that you can use your existing license for reading PDBs
  2. Spec out a feature request to start handling the different OpenEye licenses in an "a la carte" manner, so in a future release you won't have to use the workaround.

@j-wags
Copy link
Member

j-wags commented Jan 28, 2021

@mieczyslaw Here's a workaround that you can put at the top of your script to have the OpenFF toolkit attempt to use the components of OpenEye that are licensed:

from openforcefield.utils.toolkits import OpenEyeToolkitWrapper, RDKitToolkitWrapper, GLOBAL_TOOLKIT_REGISTRY
OpenEyeToolkitWrapper._is_licensed = True

# De- and Re-register RDKit so that the global ToolkitRegistry will try OE first for all operations 
# (slightly faster performance for, eg. SMIRKS matching)
GLOBAL_TOOLKIT_REGISTRY.deregister_toolkit(RDKitToolkitWrapper)
GLOBAL_TOOLKIT_REGISTRY.register_toolkit(OpenEyeToolkitWrapper)
GLOBAL_TOOLKIT_REGISTRY.register_toolkit(RDKitToolkitWrapper)

Could you let me know if this works for you?

I tested it on the following workflow, which should exercise most of the core functionality of the OpenFF toolkit. I used this toluene PDB file.

from openforcefield.topology import Molecule
from openforcefield.typing.engines.smirnoff import ForceField
mol = Molecule.from_file('toluene.pdb')
ff = ForceField('openff-1.3.0.offxml')
ff.create_openmm_system(mol.to_topology())

@mieczyslaw
Copy link
Author

mieczyslaw commented Jan 29, 2021

Thanks @j-wags ! As commercial licences are expensive, the case is that companies may afford only a subset of OE tools.

I tried to add the lines above to script1 in #822 (off top one). It seems to pick up OpenEye (no crash because of RDKit), but shows:

LICENSE: No valid license found for omega
LICENSE: File(s) used: HERE_PATH

The same output message on my side for the the workflow like you posted above (the equivalent of script2 in #822).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants