Skip to content

Building the Python package using pip in an isolated env: issues with numpy #2

@benbovy

Description

@benbovy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions