Ensuring `python3Packages.litellm` works out of the box

I was trying to run litellm normally with nix but get error:

$ nix shell nixpkgs#python3Packages.litellm.out -c litellm
...
ImportError: Missing dependency No module named 'backoff'. Run `pip install 'litellm[proxy]'`

Fortunately, the workaround is relatively easy:

$ nix-shell -E '((import <nixpkgs> {}).python3.withPackages(ps: [ps.litellm] ++ ps.litellm.optional-dependencies.proxy)).env' -c litellm

It seems no way to specify extras in pyproject, (see: poetry.script extras seems to be ignored, and scripts are always installed · Issue #6892 · python-poetry/poetry · GitHub).

I wonder how can we improve it in the nix package?

1 Like