Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip-compile generates empty requirements.txt #1796

Closed
Burtannia opened this issue Jan 11, 2023 · 5 comments
Closed

pip-compile generates empty requirements.txt #1796

Burtannia opened this issue Jan 11, 2023 · 5 comments

Comments

@Burtannia
Copy link

I'm trying to use pip-compile to generate requirements.txt from pyproject.toml but for some reason the output from pip-compile doesn't actually contain any dependencies.

Environment Versions

  1. OS: macOS Ventura 13.1
  2. Python version: 3.11.1
  3. pip version: 22.3.1
  4. pip-tools version: 6.12.1

Steps to replicate

  1. Create a pyproject.toml file containing the following:
[build-system]
requires = ["setuptools<61"]

[project]
name = "python_101"
version = "1.0.0"
description = "Demo Python app"
dependencies = ["pydantic"]

Note that without the setuptools restriction I get the following error when running pip-compile -v ...:

Creating venv isolated environment...
Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
Getting build dependencies for wheel...
Backend subprocess exited when trying to invoke get_requires_for_build_wheel
Failed to parse /Users/jburton/Projects/python_101/pyproject.toml
  1. Run the following command:
    python -m piptools compile --resolver=backtracking --generate-hashes -o requirements.txt pyproject.toml

Expected result

requirements.txt to be populated with dependencies.

Actual result

requirements.txt only contains:

#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
#    pip-compile --generate-hashes --output-file=requirements.txt --resolver=backtracking pyproject.toml
#
@q0w

This comment was marked as off-topic.

@q0w

This comment was marked as off-topic.

@Burtannia
Copy link
Author

@q0w Thanks for the quick response! As mentioned in "step 1", if I use setuptools>61 or remove the restriction and allow the default to be used then I get the following error:

Backend subprocess exited when trying to invoke get_requires_for_build_wheel
Failed to parse /Users/jburton/Projects/python_101/pyproject.toml

@q0w
Copy link
Contributor

q0w commented Jan 11, 2023

@Burtannia oh I see... Could you apply this patch #1711 (comment) and show the error. I can't reproduce

@Burtannia
Copy link
Author

@q0w Aha! It seemed to be getting confused when finding the package directory. I had a top level directory called proto containing only a .proto file which seemed to be enough for it to not find the actual package directory. Upon adding the following to my pyproject.toml everything worked:

[tool.setuptools]
packages = ["python_101"]

I've made a PR to add some debugging tips and a note about setuptools to the README #1797

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants