If you encountered this error while trying to run pip-compile, it might be that the library name added in requirements.in is incorrect. For example, I wrote
dotenv
instead of
python-dotenv
and ran pip-compile, I got the same error.