prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
2.19k stars 132 forks source link

Git package dependencies fail on systems without global git installation #1388

Open imagejan opened 1 month ago

imagejan commented 1 month ago

Checks

Reproducible example

pixi init
pixi add python
pixi add --pypi 'cowsay @ git+https://github.com/VaasuDevanS/cowsay-python.git'

On (Windows) systems with a system-wide git installation (e.g. Git for Windows), this works as expected.

On systems without git, it throws the following error:

❯ pixi add --pypi 'cowsay @ git+https://github.com/VaasuDevanS/cowsay-python.git'
  × failed to solve the pypi requirements of 'default' 'win-64'
  ├─▶ failed to resolve pypi dependencies
  ├─▶ Failed to download and build `cowsay @ git+https://github.com/VaasuDevanS/cowsay-python.git`
  ├─▶ Git operation failed
  ├─▶ failed to clone into: ************
  ├─▶ could not execute process `git fetch --force --update-head-ok https://github.com/VaasuDevanS/cowsay-python.git
  │   +HEAD:refs/remotes/origin/HEAD` (never executed)
  ╰─▶ program not found

Issue description

Installing git globally with pixi global install git didn't help, as git seems to be unavailable when the environment is resolved (while git status works fine from the command line).

Expected behavior

pixi should pull git as a dependency if required.

ruben-arts commented 1 month ago

Hi @imagejan,

We've indeed had an internal conversation about this as full reproduciblity also requires git. But since git is one of the most widely installed tools on a system we've decided not to add this feature.

And pixi add git would that fix your issue?

That said this to me is not a bug but a feature request. Let's see if this gets some more attention!

imagejan commented 1 month ago

Thanks for your comment, @ruben-arts!

pixi add git doesn't help, I still get the same error.

I can certainly work around this by making Git for Windows an obligatory prerequisite when sharing my pixi projects (or by avoiding using git dependencies altogether, in favor of direct PyPI or .whl dependencies where applicable). And I agree that git is most widely installed (although I noticed that apps like GitHub Desktop and Fork ship their own git, maybe for a reason).

Nevertheless I wanted to mention this here, as I encountered the issue when deploying on other machines at our institute, and I think it might be a useful improvement to make pixi usage really easy across platforms also for "non-tech-savvy" users 🙂.

tdejager commented 1 month ago

Actually, I believe it should be doable to use git from a pixi env. This would require a change in uv the pypi resolver that we are using. When I have the time I'll suggest a change in a PR to them and see if they are open for it.

tdejager commented 1 month ago

In the mean time would a 'pixi global install git' be a setup option for first time non-tech-savy users?

ruben-arts commented 1 month ago

In the mean time would a 'pixi global install git' be a setup option for first time non-tech-savy users?

This unfortunately doesn't work on windows for now. Git on windows is a very strange package.

We'll have to take a deeper look.