ccsb-scripps / AutoDock-Vina

AutoDock Vina
http://vina.scripps.edu
Apache License 2.0
562 stars 199 forks source link

AttributeError: module 'numpy' has no attribute 'int'. #189

Closed gmseabra closed 1 year ago

gmseabra commented 1 year ago

Hi Guys,

Thanks for this great software! I would just like to call attention to a issue that appears in newer installations: After Numpy v1.20.0, the 'np.int' type was deprecated (see here). As a result, Vina is failing with newer NumPy installs with the message below.

The solution is very simple: it is enough to change from np.int to np.int_ in line 260 of vina.py to recover the original behavior. Or, if you know the type you want, you could use np.int32 or np.int64.

All the best, Gustavo.

Computing Vina grid ... done.
Traceback (most recent call last):
  File "/blue/lic/seabra/training/vina/vina_example.py", line 15, in <module>
    v.compute_vina_maps(center=[15.190, 53.903, 16.917], box_size=[20, 20, 20])
  File "/home/seabra/.conda/envs/autodock-vina/lib/python3.11/site-packages/vina/vina.py", line 260, in compute_vina_maps
    self._voxels = np.ceil(np.array(box_size) / self._spacing).astype(np.int)
                                                                      ^^^^^^
  File "/home/seabra/.conda/envs/autodock-vina/lib/python3.11/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'inf'?
diogomart commented 1 year ago

Fixed in #167