bp-kelley / descriptastorus

Descriptor computation(chemistry) and (optional) storage for machine learning
Other
220 stars 62 forks source link

numpy.float error in newer versions of numpy #23

Open rgasper opened 11 months ago

rgasper commented 11 months ago

newer versions of numpy don't support numpy.float.

Getting this error when using descriptastorus w/ numpy==1.24.3:

Traceback (most recent call last):
  File "/opt/conda/envs/env/lib/python3.8/site-packages/descriptastorus/descriptors/rdDescriptors.py", line 336, in applyFunc
    return FUNCS[name](m)
  File "/opt/conda/envs/env/lib/python3.8/site-packages/rdkit/Chem/GraphDescriptors.py", line 124, in Ipc
    cPoly = abs(Graphs.CharacteristicPolynomial(mol, adjMat))
  File "/opt/conda/envs/env/lib/python3.8/site-packages/rdkit/Chem/Graphs.py", line 43, in CharacteristicPolynomial
    res = numpy.zeros(nAtoms + 1, numpy.float)
  File "/opt/conda/envs/env/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
rgasper commented 11 months ago

This is on descriptastorus version 2.5.0.23. I'll try upgrading and see if that fixes the issue

rgasper commented 11 months ago

Also happening w/ version 2.6.1.

This is particularly problematic as if you use descriptastorus on a lot of molecules in a jupyter notebook, the number of error messages crashes the notebook!

rgasper commented 11 months ago

this isn't really descriptastorus' problem

bp-kelley commented 11 months ago

No, float should be used, the numpy.float has been deprecated for a while, I’ll update the build.

rgasper commented 11 months ago

well the error is in rdkit itself I realized

rgasper commented 11 months ago

oh lol you are also there and aware! Carry on

bp-kelley commented 11 months ago

I need to bump the rdkit and numpy versions :)