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

Incompatible with Numpy 1.24.1 #159

Open
GregorySchwing opened this issue Jan 11, 2023 · 0 comments
Open

Incompatible with Numpy 1.24.1 #159

GregorySchwing opened this issue Jan 11, 2023 · 0 comments

Comments

@GregorySchwing
Copy link

Expected behaviour

plt.plot(hbonds.timesteps, hbonds.count_by_time(), lw=2)
Plot my function

Actual behaviour

plt.plot(hbonds.timesteps, hbonds.count_by_time(), lw=2)


AttributeError Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 plt.plot(hbonds.timesteps, hbonds.count_by_time(), lw=2)

File ~/anaconda3/envs/hbond3/lib/python3.8/site-packages/pmda-0.3.0+22.ge6ac508-py3.8.egg/pmda/hbond_analysis.py:494, in HydrogenBondAnalysis.count_by_time(self)
491 indices /= self.step
493 counts = np.zeros_like(self.frames)
--> 494 counts[indices.astype(np.int)] = tmp_counts
495 return counts

File ~/anaconda3/envs/hbond3/lib/python3.8/site-packages/numpy/init.py:284, in getattr(attr)
281 from .testing import Tester
282 return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
285 "{!r}".format(name, attr))

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

This link explains how the numpy aliases. such as np.int() are no longer supported and should be replaced without the "np." prefix.
https://levelup.gitconnected.com/fix-attributeerror-module-numpy-has-no-attribute-float-d7d68c5a4971

Therefore, a simple find and replace for np.int(x) -> int(x); and for the other aliases should fix this

Code to reproduce the behaviour

See attached
pmda_test.py.txt

Currently version of MDAnalysis:

Git : 0.3.0+22.ge6ac508
Numpy: 1.24.1

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

1 participant