Description
The error is straightforward, but the reason for it is not. I want to use uv
everywhere.
All I did was create a new test project with hatch new foo
, then add the minimal config sections as well as the desired uv
settings to the generated pyproject.toml
. Here is an abbreviated version:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "foo"
version = "0.0.1"
[tool.hatch.env]
requires = [
"hatch-pip-compile"
]
[tool.hatch.envs.default]
installer = "uv"
type = "pip-compile"
pip-compile-resolver = "uv"
pip-compile-installer = "uv"
To get that error I just ran any hatch
command, e.g. hatch run ls
or hatch env show
.
I don't have pip installed globally on my system, nor do I want it. I want to use uv
everywhere. It seems somewhere in the code of hatch-pip-compile
it relies on the existence of a globally installed pip
for some reason.
It also does not help to debug the problem that all I get is that line /usr/bin/python: No module named pip
. No traceback or anything. Because of this, I did not even know where to begin to search in the source code for the cause of the error. It is surprising that the chosen Python executable also seems to be the system Python, rather than any of the Hatch-Python versions, but that may be a separate issue.
I would love to use this plugin because I think it fills a giant hole in Hatch's dependency management. Please let me know, if you need any more information or for me to try something specific.
PS: I just saw that pip-tools
is a base dependency here, which in turn of course depends on pip
. I don't know, if that is the cause of the issue. But if you want to allow people to use uv
instead, as it seems from the documentation and the options to use it as a resolver and installer, that might not be a great idea.