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

update to numpy 1.24 #3

Closed
WreckItTim opened this issue May 18, 2023 · 4 comments
Closed

update to numpy 1.24 #3

WreckItTim opened this issue May 18, 2023 · 4 comments

Comments

@WreckItTim
Copy link

great lib, can you please update to numpy 1.24. Thank you!

@faridyagubbayli
Copy link
Owner

Hey Tim! Thanks for letting me know about this issue.

I just fixed the installation process and made a new release (1.6.0). It is live on pypi and you can install it using pip install binvox. Please feel free to re-open the issue if the fix doesn't work for you.

@egidioln
Copy link

egidioln commented Aug 10, 2023

Hello @faridyagubbayli,

Thanks for this support. I'm still facing some incompatibility with numpy 1.24. For example, the following code crashes:

import numpy as np
from binvox import Binvox
bv = Binvox(axis_order="xyz", data=np.ones((3,3,3)))
bv.to_sparse()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...\binvox\binvox.py", line 195, in to_sparse
    self.data = np.asarray(np.nonzero(self.data), np.int)
  File "...\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'?

The np.int alias for int was deprecated. Could we maybe change these four lines (np.int -> int or np.int32)?

self.data = np.asarray(np.nonzero(self.data), np.int)

xyz = self.data.astype(np.int)

def dense_to_sparse(voxel_data, dtype=np.int):

xyz = voxel_data.astype(np.int)

Cheers

@egidioln
Copy link

egidioln commented Aug 10, 2023

Oups, and also these four (np.bool -> bool)

data = np.repeat(values, counts).astype(np.bool)

values = values.astype(np.bool)

data = np.repeat(values, counts).astype(np.bool)

values = values.astype(np.bool)

@WreckItTim
Copy link
Author

Hello, yes the problem still persists. Just need to switch all of the "np.bool" with "bool" and it will run fine on new numpy. Can you please update the repo so that pip install reflects this - currently it does not.

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

3 participants