Currently a pyproject.toml
(PEP518) is used to specify the tools needed to build the package. This is nice because users don't need to worry about installing these tools first.
However, numpy is needed to both build (using f2py) and import this package at runtime. Build isolation (PEP517) causes issues here. If we add numpy to the build requirements in pyproject.toml
, we might have numpy version mismatch at runtime (e.g., when using conda environments) and the package is not usable. If we don't add numpy to the build requirements, we might get a CMake error (numpy not found).
A workaround is to deactivate build isolation, i.e.,
$ pip install . --no-build-isolation
But then we loose the benefits of build requirements in pyproject.toml
and users need to install all these tools manually, e.g., using pip or conda:
$ pip install setuptools wheel cmake scikit-build ninja numpy
$ conda install setuptools wheel cmake scikit-build ninja numpy -c conda-forge
Maybe related discussion: pypa/pip#6144