I ran into this problem when my pip requirements.txt file contained an editable library that was built using poetry and contained a pyproject.toml file. Following the documentation for setuptools, my solution was to add setuptools to the build-system requirements in the pyproject.toml file as follows:
[build-system]requires = ["poetry-core>=1.0.0", "setuptools"]build-backend = "poetry.core.masonry.api"