DESI-UR / VAST

Void Analysis Software Toolkit
https://vast.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
10 stars 8 forks source link

Numpy version issues and deprecated functions #113

Open gideonkmc opened 5 days ago

gideonkmc commented 5 days ago

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 commented 4 days ago

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 commented 4 days ago

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!