compile failure due to numpy issues in transformations.c
Expected behavior
pip install build/compiles cleanly
Actual behavior
See https://discord.com/channels/807348386012987462/808088023957897258/1381767573611483176 by @ljwoods2
Curious if I'm missing something, is anyone else getting a Numpy compatibility issue when trying to build MDA from source with pip? Looks like transformations.c relies on the old numpy API (NPY_IN_ARRAY, etc), and I can't build wheel sucessfully and clear errors like this (long list of them from MDAnalysis/lib/src/transformations/transformations.c) unless I change numpy to an earlier version (<1.24) in the build-system "requires" list:
MDAnalysis/lib/src/transformations/transformations.c:794:57: error: ‘NPY_ALIGNED’ undeclared (first use in this function); did you mean ‘Py_ALIGNED’?
*address = PyArray_FROM_OTF(object, NPY_DOUBLE, NPY_ALIGNED);
Plus, above should throw a deprecation warning / error instead of just failing, right? I see @orbeckst 's issue (https://github.com/MDAnalysis/mdanalysis/issues/2988) about suppressing the deprecated warnings, but looks like it hasn't been fixed yet, so I should still see the warning?
Apologies if this is something obvious, but I figured Numpy >2.0 is supposed to be able to handle the old API usage? If this is not just me being dumb I will raise an issue
Code to reproduce the behavior
All I did was:
git clone [email protected]:MDAnalysis/mdanalysis.git
git checkout develop
conda create -n broken python=3.11 pip
conda activate broken
cd mdanalysis/package
pip install .
Current version of MDAnalysis
- Which version are you using? (run
python -c "import MDAnalysis as mda; print(mda.__version__)") - Which version of Python (
python -V)? - Which operating system?
I’m proposing to remove the vendored code and replace it with an import of the (slightly more) modern transformations package. That’s easier than updating the vendored code.
Eventually we might just remove transformations as a dependency because we don’t use a lot of the package and we might be able to get away with what’s in Scipy.
To also update here #5068 has the requisite C changes to fix compile issues, but we should remove the vendor long term.
Closed with PR #5068.
(We can removed the vendored code later.)