For distributing Python libraries on PyPi, I usually specify the package's dependencies in setup.py à la
setup(
    # ...
    install_requires=["numpy", "scipy"],
    # ...
)
In some cases, however, I already need to import something in the setup.py, for example when using pybind11. The recommended way for finding the pybind11 include directory is via
def __str__(self):
    import pybind11  # !
    return pybind11.get_include(self.user)
Hence, the user needs pybind11 installed before pip tries to install the library itself. Unfortunately, simply adding the module to install_requires doesn't cut it: One gets
  ModuleNotFoundError: No module named 'pybind11'
when trying to install. Is there a way to enforce installation of requirements before evaluating setup.py?
