rdkit / conda-rdkit

Conda build recipe for the rdkit
50 stars 30 forks source link

ArgumentError: Python argument types in rdkit.Chem.rdMolDescriptors.CalcCrippenDescriptors(NoneType) did not match C++ signature: #87

Closed muammar closed 4 years ago

muammar commented 4 years ago

I installed rdkit using conda as mentioned on #84.

conda create -c rdkit -n my-rdkit-env rdkit=2019.09.2

Then, when I try to use MolLogP:

df['mol'] = df.inchi.apply(MolFromInchi)
df['logp'] = df.mol.apply(Descriptors.MolLogP)

rdkit always fail with:

---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
<ipython-input-7-d1600f543d97> in <module>
----> 1 df['logp'] = df.mol.apply(Descriptors.MolLogP)

~/anaconda3/envs/my-rdkit-env/lib/python3.6/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds)
   4043             else:
   4044                 values = self.astype(object).values
-> 4045                 mapped = lib.map_infer(values, f, convert=convert_dtype)
   4046 
   4047         if len(mapped) and isinstance(mapped[0], Series):

pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()

~/anaconda3/envs/my-rdkit-env/lib/python3.6/site-packages/rdkit/Chem/Crippen.py in <lambda>(*x, **y)
    168 _pyMolMR.version = "1.1.0"
    169 
--> 170 MolLogP = lambda *x, **y: rdMolDescriptors.CalcCrippenDescriptors(*x, **y)[0]
    171 MolLogP.version = rdMolDescriptors._CalcCrippenDescriptors_version
    172 MolLogP.__doc__ = """ Wildman-Crippen LogP value

ArgumentError: Python argument types in
    rdkit.Chem.rdMolDescriptors.CalcCrippenDescriptors(NoneType)
did not match C++ signature:
    CalcCrippenDescriptors(RDKit::ROMol mol, bool includeHs=True, bool force=False)

The C++ version used I suppose is the one shipped by anaconda:

py-boost                  1.67.0           py36h04863e7_4  

The complete list:

# packages in environment at /home/muammar/anaconda3/envs/my-rdkit-env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
ase                       3.19.0                   pypi_0    pypi
attrs                     19.3.0                     py_0  
backcall                  0.1.0                    py36_0  
blas                      1.0                         mkl  
bleach                    3.1.0                    py36_0  
bzip2                     1.0.8                h7b6447c_0  
ca-certificates           2019.11.27                    0  
cairo                     1.14.12              h8948797_3  
certifi                   2019.11.28               py36_0  
cycler                    0.10.0                   pypi_0    pypi
decorator                 4.4.1                      py_0  
defusedxml                0.6.0                      py_0  
entrypoints               0.3                      py36_0  
fontconfig                2.13.0               h9420a91_0  
freetype                  2.9.1                h8a8886c_1  
glib                      2.63.1               h5a9c865_0  
gmp                       6.1.2                h6c8ec71_1  
icu                       58.2                 h9c2bf20_1  
importlib_metadata        1.3.0                    py36_0  
intel-openmp              2019.4                      243  
ipykernel                 5.1.3            py36h39e3cac_0  
ipython                   7.10.2           py36h39e3cac_0  
ipython_genutils          0.2.0                    py36_0  
jedi                      0.15.1                   py36_0  
jinja2                    2.10.3                     py_0  
jpeg                      9b                   h024ee3a_2  
json5                     0.8.5                      py_0  
jsonschema                3.2.0                    py36_0  
jupyter_client            5.3.4                    py36_0  
jupyter_core              4.6.1                    py36_0  
jupyterlab                1.2.4              pyhf63ae98_0  
jupyterlab_server         1.0.6                      py_0  
kiwisolver                1.1.0                    pypi_0    pypi
libboost                  1.67.0               h46d08c1_4  
libedit                   3.1                  heed3624_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0  
libpng                    1.6.37               hbc83047_0  
libsodium                 1.0.16               h1bed415_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.1.0                h2733197_0  
libuuid                   1.0.3                h1bed415_2  
libxcb                    1.13                 h1bed415_1  
libxml2                   2.9.9                hea5a465_1  
markupsafe                1.1.1            py36h7b6447c_0  
matplotlib                3.1.2                    pypi_0    pypi
mistune                   0.8.4            py36h7b6447c_0  
mkl                       2019.4                      243  
mkl-service               2.3.0            py36he904b0f_0  
mkl_fft                   1.0.15           py36ha843d7b_0  
mkl_random                1.1.0            py36hd6b4f25_0  
more-itertools            8.0.2                      py_0  
nbconvert                 5.6.1                    py36_0  
nbformat                  4.4.0                    py36_0  
ncurses                   6.0                           0    rdkit
notebook                  6.0.2                    py36_0  
numpy                     1.17.4           py36hc1035e2_0  
numpy-base                1.17.4           py36hde5b4d6_0  
olefile                   0.46                     py36_0  
openssl                   1.0.2u               h7b6447c_0  
pandas                    0.25.3           py36he6710b0_0  
pandoc                    2.2.3.2                       0  
pandocfilters             1.4.2                    py36_1  
parso                     0.5.2                      py_0  
pcre                      8.43                 he6710b0_0  
pexpect                   4.7.0                    py36_0  
pickleshare               0.7.5                    py36_0  
pillow                    6.2.1            py36h34e0f95_0  
pip                       19.3.1                   py36_0  
pixman                    0.38.0               h7b6447c_0  
prometheus_client         0.7.1                      py_0  
prompt_toolkit            3.0.2                      py_0  
ptyprocess                0.6.0                    py36_0  
py-boost                  1.67.0           py36h04863e7_4  
pygments                  2.5.2                      py_0  
pyparsing                 2.4.6                    pypi_0    pypi
pyrsistent                0.15.6           py36h7b6447c_0  
python                    3.6.5                hc3d631a_2  
python-dateutil           2.8.1                      py_0  
pytz                      2019.3                     py_0  
pyzmq                     18.1.0           py36he6710b0_0  
rdkit                     2019.09.2.0      py36hc20afe1_1    rdkit
readline                  7.0                  ha6073c6_4  
scipy                     1.4.1                    pypi_0    pypi
send2trash                1.5.0                    py36_0  
setuptools                42.0.2                   py36_0  
six                       1.13.0                   py36_0  
sqlite                    3.23.1               he433501_0  
terminado                 0.8.3                    py36_0  
testpath                  0.4.4                      py_0  
tk                        8.6.8                hbc83047_0  
tornado                   6.0.3            py36h7b6447c_0  
traitlets                 4.3.3                    py36_0  
wcwidth                   0.1.7                    py36_0  
webencodings              0.5.1                    py36_1  
wheel                     0.33.6                   py36_0  
xz                        5.2.4                h14c3975_4  
zeromq                    4.3.1                he6710b0_3  
zipp                      0.6.0                      py_0  
zlib                      1.2.11               h7b6447c_3  
zstd                      1.3.7                h0b5b093_0  

What is the right version of C++/Boost to be installed? I would appreaciate any help.

muammar commented 4 years ago

I think I solved it with:

conda install -y boost-cpp boost py-boost
adenkics commented 2 years ago

I tried your method, but I did not solve my problem

Aleksandr-biochem commented 2 years ago

I gonna leave it here as this one is shown first in google

I had quite similar issue trying to reproduce following example with RDkit: https://iwatobipen.wordpress.com/2019/11/07/calculate-free-solvent-accessible-surface-area-rdkit-chemoinformatics/

I was running into the following error: ArgumentError: Python argument types in rdkit.Chem.rdFreeSASA.classifyAtoms(Mol) did not match C++ signature: classifyAtoms(RDKit::ROMol {lvalue} mol, FreeSASA::SASAOpts options=<rdkit.Chem.rdFreeSASA.SASAOpts object at 0x7fcde61633c0>)

Eventually I made it work by creating a new conda environment: conda create --name myenv

Then installed rdkit to it: conda activate myenv conda install -c rdkit rdkit

In order to create a kernell to switch in jupyter (view https://stackoverflow.com/questions/58882055/python-doesnt-see-packages-with-jupyter-notebook): conda install -c anaconda ipykernel ipython kernel install --user --name=myenv

Then you will be able to choose this kernell in jupyter. Running the code lines on new kernell with just rdkit installed solved my issue

greglandrum commented 2 years ago

Please install the rdkit from the conda-forge channel instead of the RDKit channel.

adenkics commented 2 years ago

Please install the rdkit from the conda-forge channel instead of the RDKit channel.

What confuses me is that even if I have installed rdkit with conda-forge, I often get errors like this

image
ikunpy commented 1 year ago

the rdkit is less useful than OpenBabel, they need to fix this problem