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

Set upper bound for numpy version #69

Closed
a-r-j opened this issue Jan 2, 2023 · 2 comments
Closed

Set upper bound for numpy version #69

a-r-j opened this issue Jan 2, 2023 · 2 comments

Comments

@a-r-j
Copy link

a-r-j commented Jan 2, 2023

Hiya,

I run into an error with newer numpy versions (1.24.0):

File ~/work/graphein/graphein/graphein/molecule/features/graph/molecule.py:67, in <dictcomp>(.0)
     62     descriptors = {
     63         k: v for k, v in descriptors.items() if k in descriptor_list
     64     }
     66 # Compute descriptors
---> 67 desc = {d: descriptors[d](mol) for d in descriptors}
     69 # Process Outformat
     70 if return_array:

File /usr/share/miniconda/envs/__setup_conda/lib/python3.8/site-packages/rdkit/Chem/GraphDescriptors.py:124, in Ipc(mol, avg, dMat, forceDMat)
    121       mol._adjMat = dMat
    123 adjMat = numpy.equal(dMat, 1)
--> 124 cPoly = abs(Graphs.CharacteristicPolynomial(mol,adjMat))
    125 if avg:
    126   return entropy.InfoEntropy(cPoly)

File /usr/share/miniconda/envs/__setup_conda/lib/python3.8/site-packages/rdkit/Chem/Graphs.py:43, in CharacteristicPolynomial(mol, mat)
     41 I = 1. * numpy.identity(nAtoms)
     42 An = A
---> 43 res = numpy.zeros(nAtoms + 1, numpy.float)
     44 res[0] = 1.0
     45 for n in range(1, nAtoms + 1):

File /usr/share/miniconda/envs/__setup_conda/lib/python3.8/site-packages/numpy/__init__.py:284, in __getattr__(attr)
    2[81](https://github.com/a-r-j/graphein/actions/runs/3680239676/jobs/6320741907#step:8:82)     from .testing import Tester
    2[82](https://github.com/a-r-j/graphein/actions/runs/3680239676/jobs/6320741907#step:8:83)     return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
    285                      "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'float'

From this article it appears some aliases (like np.float) have been deprecated. As a result, I think the supported NumPy versions should be constrained or the underlying code refactored to support new versions.

@kuelumbus
Copy link
Owner

Hi. This was already fixed in the RDKit repository (rdkit/rdkit#5897). The next RDKit PyPI release should work Numpy >=1.24. In the meantime, please use an older numpy version. Hope this works for you.

Please leave this issue open until the next version is released.

@kuelumbus
Copy link
Owner

Should be fixed in the 2022.9.4 release.

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

No branches or pull requests

2 participants