For some (unspecified) reason the numpy template contains this in its post_install():
# create compat symlinks for .h files
vmkdir ${py3_inc}
ln -sfr ${DESTDIR}/${py3_sitelib}/numpy/core/include/numpy \
${DESTDIR}/${py3_inc}
This creates a symlink /usr/include/python3.10/numpy -> ../../lib/python3.10/site-packages/numpy/core/include/numpy
In effect this means that whenever one uses -I/usr/include/python3.10 to add python headers, one is also adding system numpy headers.
The problem arises when one uses a different version of numpy installed in a venv. To compile against numpy headers one would add -I$VENV/lib/python3.10/site-packages/numpy/core/include to use those headers. However, when the CFLAGS has something like -I/usr/include/python3.10 -I$VENV/lib/python3.10/site-packages/numpy/core/include the symlink installed in the python include dir will take precedence.
This gives a runtime error, e.g. when system numpy is 1.22 (as in void) and venv numpy is 1.21 (as in sagemath) since those versions are binary-incompatible (the numpy.ndarray structure changed size).
A workaround is to ensure the numpy include dir always comes before the python include dir, but the issue is bound to resurface since controlling the order of stuff placed on CFLAGS is kind of difficult.
As a concrete example: sage-9.5 (current release) used to build ok on void linux but after numpy upgraded to 1.22 it no longer builds (this does NOT affect our template for sagemath -- we don't use a venv). See: https://trac.sagemath.org/ticket/33473.
Arguably, nothing else than python headers should be installed in /usr/include/python3.10; installing headers from other packages there is forcing the use of a particular version of the package.
Note: debian/ubuntu also adds this symlink. I didn't find other distros that do (I only looked at a few).
For some (unspecified) reason the numpy template contains this in its
post_install():This creates a symlink
/usr/include/python3.10/numpy -> ../../lib/python3.10/site-packages/numpy/core/include/numpyIn effect this means that whenever one uses
-I/usr/include/python3.10to add python headers, one is also adding system numpy headers.The problem arises when one uses a different version of numpy installed in a venv. To compile against numpy headers one would add
-I$VENV/lib/python3.10/site-packages/numpy/core/includeto use those headers. However, when theCFLAGShas something like-I/usr/include/python3.10 -I$VENV/lib/python3.10/site-packages/numpy/core/includethe symlink installed in the python include dir will take precedence.This gives a runtime error, e.g. when system numpy is 1.22 (as in void) and venv numpy is 1.21 (as in sagemath) since those versions are binary-incompatible (the numpy.ndarray structure changed size).
A workaround is to ensure the numpy include dir always comes before the python include dir, but the issue is bound to resurface since controlling the order of stuff placed on CFLAGS is kind of difficult.
As a concrete example: sage-9.5 (current release) used to build ok on void linux but after numpy upgraded to 1.22 it no longer builds (this does NOT affect our template for sagemath -- we don't use a venv). See: https://trac.sagemath.org/ticket/33473.
Arguably, nothing else than python headers should be installed in
/usr/include/python3.10; installing headers from other packages there is forcing the use of a particular version of the package.Note: debian/ubuntu also adds this symlink. I didn't find other distros that do (I only looked at a few).