-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Hard-coded reliance on global pip
? - Error: /usr/bin/python: No module named pip
#85
Comments
The plugin shouldn't be using a global
I'll need to figure out how to replicate this so I can resolve it - do you know of any docker images I might be able to use to replicate your issue? |
@juftin Thank you for the quick response. It seems to me (though this is just an educated guess) that it does not even get to the virtual environment. The error comes up immediately without noticeable delay. I'll see, if I can make this more easily reproducible with a docker image and get back to you. So far the best I can offer is a few more system specs:
As a side note, I am not sure it is necessary to use |
That sounds good - some kind of Docker image with Python, without I'm guessing that the ultimate issue here is that
Feel free to read through this discussion here if you're curious why private modules were used: #51 (comment). |
Ah! This is an issue with See this Dockerfile where [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" Dockerfile
FROM fedora:latest
RUN dnf install -y python3 hatch
WORKDIR /work
RUN touch /work/pyproject.toml
RUN cat <<EOF > /work/pyproject.toml
[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"
EOF
RUN mkdir /work/foo
RUN touch /work/foo/__init__.py
CMD ["hatch", "run", "ls"]
docker build . --tag hatch-pip-compile-test
docker run --rm -it hatch-pip-compile-test
|
This would be an issue with Hatch indeed but I'm not sure the behavior people desire exactly. The issue is that plugins currently must live in the same installation as Hatch so if there is no pip the assumption fails. For example, if you change that installation line to also add So I guess there are three options:
What do you think? The final one would be interesting because the plugins would persist across Hatch updates but would be prone to errors because if any dependencies are not pure Python then upgrading the Python version with which Hatch is running would cause issues so special care must be taken. |
Thanks for the thoughtful response as always! For the above example (without [tool.hatch.env]
requires = [
"hatch-pip-compile"
]
installer = "uv" As an alternative, since |
Yeah sounds good, I just don't have a timeframe currently but I will do that. |
Those are some interesting insights. I appreciate both of you taking the time to think about this. |
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 desireduv
settings to the generatedpyproject.toml
. Here is an abbreviated version:To get that error I just ran any
hatch
command, e.g.hatch run ls
orhatch 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 ofhatch-pip-compile
it relies on the existence of a globally installedpip
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 onpip
. I don't know, if that is the cause of the issue. But if you want to allow people to useuv
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.The text was updated successfully, but these errors were encountered: