uv icon indicating copy to clipboard operation
uv copied to clipboard

uv sync any project :hatchling.build.get_requires_for_build_editable

Open yanzengyun opened this issue 6 months ago • 4 comments

Question

When running uv sync, I encountered a build error for a local package:

Resolved 158 packages in 3ms
x Failed to build test1 @ file:///D:/pycharm/uv/test1

|-> The build backend returned an error
-> Call to hatchling.build.get_requires_for_build_editable` failed: expected value at line 1 column 1 (exit code: 0)
hint: This usually indicates a problem with the package or the build environment. I've been struggling with this for quite some time. Whether I set the build backend in pyproject.toml to hatchling or setuptools, the build still fails with the same error.

My environment is Windows 11. The project follows a standard Python package structure, and the pyproject.toml file appears to be correctly configured.

I'm not sure if the issue is with uv, the build backend, or something in my own setup.

What should I do next to diagnose or fix this problem? Please let me know if you need additional logs or configuration details.

Image Image

Platform

windows11

Version

latest

yanzengyun avatar May 17 '25 06:05 yanzengyun

how can i do ,please.

yanzengyun avatar May 17 '25 06:05 yanzengyun

Try running uv init --lib foo and looking at the way that the project in foo is structured. Hatchling has some expectations around the structure, e.g., do you have a subdirectory test1 or src/test1?

charliermarsh avatar May 17 '25 11:05 charliermarsh

Try running and looking at the way that the project in is structured. Hatchling has some expectations around the structure, e.g., do you have a subdirectory or ?uv init --lib foo``foo``test1``src/test1

Image

I created a project using uv init --lib test1, then ran uv sync, but the problem still exists.

Image

I still tried running uv pip install -e ., and the issue persists. but pip install -e . worked

yanzengyun avatar May 17 '25 11:05 yanzengyun

Do you need to be using that aliyun mirror? If so, you should configure uv to look at it. You can add:

[[tool.uv.index]]
url = "https://mirrors.aliyun.com/pypi/simple"
default = true

To your pyproject.toml.

Otherwise, can you create a full reproduction (like a Git repo I can clone) to understand your issue?

charliermarsh avatar May 17 '25 11:05 charliermarsh

Closing for now, but can re-open with an MRE!

charliermarsh avatar May 18 '25 21:05 charliermarsh