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

Error installing with Numpy 2.0 #36

Open
alejandrobll opened this issue Jul 5, 2024 · 5 comments
Open

Error installing with Numpy 2.0 #36

alejandrobll opened this issue Jul 5, 2024 · 5 comments

Comments

@alejandrobll
Copy link
Owner

As Numpy 2.0 has broken some parts of the code, use Numpy 1.26.4 until we make the required changes to adhere to the new C-API:

pip install numpy==1.26.4

Sorry for the inconvenience.

@VictorForouhar
Copy link
Contributor

I found an error that I think is related to what you mention here. I encountered it because I was setting up after the COSMA update.

My steps to reproduce (modules = 1)cosma/2018 2) python/3.12.4(default) 3) utils/201805(default):

python3 -m venv bug_test
source bug_test/bin/activate
pip install numpy setuptools
git clone https://github.com/alejandrobll/py-sphviewer.git
python setup.py install

This throws two errors, e.g:

sphviewer/extensions/scenemodule.c:79:69: error: ‘PyArray_FLOAT’ undeclared (first use in this function); did you mean ‘PyArray_ISFLOAT’?
PyArrayObject *cont_obj = PyArray_ContiguousFromObject(array_obj, PyArray_FLOAT, 1, 3);

Based on this solution, I changed PyArray_FLOAT and PyArray_DOUBLE to NPY_FLOAT and NPY_DOUBLE. Doing so installs it successfully with numpy 2.0.0.

I created a merge request here: #37

@VictorForouhar
Copy link
Contributor

I suspect that setup.py will also need updating. This is because, despite being able to install it, pip throws some warnings (and apparently duplicates pip list entries) after installing. The alternative of installing using pip install py-sphviewer was not working, as it was not detecting my installation of numpy (I suspect it was not looking for it in my venv).

@alejandrobll
Copy link
Owner Author

alejandrobll commented Jul 16, 2024 via email

@VictorForouhar
Copy link
Contributor

Hi Alejandro,

I agree that the naming is confusing. I went digging a little bit deeper, and PyArray seems to be numpy specific. Based on that, it is not that unsurprising that they now prefer using NPY_ (and it is less confusing!)

In terms of why the old name stopped working. This header contained name equivalences between PyArray_DTYPE and NPY_DTYPE. The file is no longer present in numpy 2.0.

Thanks,
Victor.

@alejandrobll
Copy link
Owner Author

alejandrobll commented Jul 16, 2024 via email

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