Skip to content

When wheels are deployed, pybind11 is unnecessarily installed #45

Closed
pybind/pybind11
#1995
@paulmelnikow

Description

@paulmelnikow

Hi! Thanks so much for this very useful example. I've been studying it as I've been trying to understand the best way to set up wheels for a project.

I see that pybind11 is in both install_requires and setup_requires. When installing a source distribution through pip, pip will first install pybind11, so the headers are available and the build works.

If it's removed from install_requires, I need to install pybind11 and my project together. Otherwise I get errors like this:

    bindings.cc:1:10: fatal error: 'pybind11/pybind11.h' file not found
    #include <pybind11/pybind11.h>
             ^~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1

However there's a downside. If I build a wheel, when it's later installed the install_requires take effect, and pybind11 is installed on the deployment machine. As far as I can tell this is completely unnecessary as the built extensions do not have a runtime dependency on pybind11.

What I would like is these two behaviors:

  • When a downstream user is installing the source distribution, pybind11 is installed.
  • When a wheel is built, the wheel does not declare an install dependency on pybind11.

This probably is not a pybind issue; it's more of a setuptools issue as it relates to pybind11, though this seems like a good place to develop the recipe.

One idea is to remove pybind11 from install_requires and add some code that runs on build_ext to programmatically install pybind11 (when a valid version isn't already available).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions