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

Numpy version issues and deprecated functions #113

Open
gideonkmc opened this issue Nov 14, 2024 · 2 comments
Open

Numpy version issues and deprecated functions #113

gideonkmc opened this issue Nov 14, 2024 · 2 comments

Comments

@gideonkmc
Copy link

Hi,

I've been using VAST for my research, and I have run into a few issues with Numpy compatibility. For example, I ran the $\text{V}^2$ example script from the command line and got the following error:

python vsquared.py -c DR7_config.ini 
AttributeError: module 'numpy' has no attribute 'product'

I was using numpy 2.1.3 which explains why I got this error, since np.product was deprecated in numpy 1.25.0. In an attempt to fix this issue, I changed every np.product into np.prod and reran the example scripts. This change fixed the error in $\text{V}^2$, but when I ran the VoidFinder example script, I got a new error:

python SDSS_VoidFinder_dr7.py
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

If I downgrade numpy to 1.25.0, I don't get this error anymore, and both example scripts run fine. I'm not sure what exactly is causing this new error, but it seems to be related to the version of numpy used. Any help would be appreciated!

@QuiteAFoxtrot
Copy link
Collaborator

QuiteAFoxtrot commented Nov 15, 2024

I think this is incumbent on us to upgrade the vsquared modules to use the newer Numpy API, though 1.25.0 isn't that old yet

As for the binary incompatibility thing, thats usually an artifact related to improper numpy installations (sometimes caused by doing things like upgrading or downgrading). Often can be better to use a virtualenv and then wipe the whole virtualenv completely and reinstall, if that helps

@gideonkmc
Copy link
Author

Thanks for the tip! I'm using a mamba/conda environment and I tried both reinstalling numpy and wiping the whole environment and starting from scratch, but neither fixed the issue. I suspect that I inadvertently messed something up when I changed np.product to np.prod. After reinstalling VAST in a new mamba environment with numpy=1.24.0, everything seems to work fine!

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