netcdf4-python
netcdf4-python copied to clipboard
Use of --includedir from nc-config in build
Version: 1.6.2 Environment: Linux, Cray Compiler with GNU, Python 3.8.5 Steps:
Trying to install netcdf4 pip package on Cray system. Using:
$ module swap PrgEnv-cray PrgEnv-gnu
$ module load cray-netcdf
$ module load cray-hdf5
$ module load cray-python
$ python -m venv venv
$ . venv/bin/activate
$ nc-config --all
...
--cflags -> -DpgiFortran
...
--includedir -> /opt/cray/pe/netcdf/4.7.4.4/GNU/8.3/include
$ pip install netCDF4==1.6.2
...
src/netCDF4/_netCDF4.c:749:10: fatal error: netcdf.h: No such file or directory
749 | #include "netcdf.h"
| ^~~~~~~~~~
compilation terminated.
It looks like the --cflags are only used in the build setup and the --includedir from nc-config is ignored.
https://github.com/Unidata/netcdf4-python/blob/0e1d3369d97522e7eaaa70f9c5d24f116d677068/setup.py#L429
Workaround was to:
NETCDF4_DIR=$NETCDF_DIR USE_NCCONFIG=0 pip install netCDF4==1.6.2
Should --includedir from nc-config be automatically added to build include search path?
perhaps you are correct - usually the include directory ends up in cflags but in your case it did not for some reason.