astral-sh/rye

Rye (uv) cannot resolve dependencies in GitHub workflow

patrick-egenlauf opened this issue · 1 comments

One package (jax) can not be resolved when rye sync is executed inside a GitHub workflow. However, on my local machine it works perfectly.

Workflow

name: CI
on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
jobs:
  build_and_test:
    name: Build and Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    
    steps:
      - uses: actions/checkout@v4

      - name: Rye
        uses: eifinger/setup-rye@v4
        with:
          version: 'latest'
          enable-cache: false

      - name: Sync dependencies
        run: rye sync

      - name: Type-Check
        run: rye run ci

Output of the failed step

> Run rye sync
Initializing new virtualenv in /Users/runner/work/project/project/.venv
Python version: cpython@3.12.5
Generating production lockfile: /Users/runner/work/project/project/requirements.lock
  × No solution found when resolving dependencies:
  ╰─▶ Because jax-cuda12-plugin[with-cuda]==0.4.31 has no wheels
      with a matching Python ABI tag and jax[cuda12]==0.4.31 depends
      on jax-cuda12-plugin[with-cuda]==0.4.31, we can conclude that
      jax[cuda12]==0.4.31 cannot be used.
      And because only jax[cuda12]<=0.4.31 is available and you require
      jax[cuda12]>=0.4.31, we can conclude that your requirements are
      unsatisfiable.
error: could not write production lockfile for project

Caused by:
    Failed to run uv compile /var/folders/m4/5dz5h26x329cqq4fx333f8gm0000gn/T/.tmp1asOAq/requirements.txt. uv exited with status: exit status: 1

Part of my pyproject.toml file

dependencies = [
    "matplotlib>=3.9.2",
    "jax[cuda12]>=0.4.31",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
    "pytest>=8.3.2",
    "coverage>=7.6.1",
]

[tool.rye.scripts]
ci = { chain = [
    "ci:lint",
    "ci:format",
    "ci:coverage",
    "ci:coverage_xml",
    "ci:print_coverage_report",
] }
"ci:lint" = "rye lint"
"ci:format" = "rye format --check"
"ci:coverage" = "rye run coverage run -m pytest"
"ci:coverage_xml" = "rye run coverage xml"
"ci:print_coverage_report" = "rye run coverage report -m"

requirements.lock file

# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
#   pre: true
#   features: []
#   all-features: false
#   with-sources: false
#   generate-hashes: false
#   universal: false

-e file:.
contourpy==1.3.0
    # via matplotlib
cycler==0.12.1
    # via matplotlib
fonttools==4.53.1
    # via matplotlib
jax==0.4.31
    # via physysim
jax-cuda12-pjrt==0.4.31
    # via jax-cuda12-plugin
jax-cuda12-plugin==0.4.31
    # via jax
jaxlib==0.4.31
    # via jax
kiwisolver==1.4.7
    # via matplotlib
matplotlib==3.9.2
    # via physysim
ml-dtypes==0.4.0
    # via jax
    # via jaxlib
numpy==2.1.1
    # via contourpy
    # via jax
    # via jaxlib
    # via matplotlib
    # via ml-dtypes
    # via opt-einsum
    # via scipy
nvidia-cublas-cu12==12.6.1.4
    # via jax-cuda12-plugin
    # via nvidia-cudnn-cu12
    # via nvidia-cusolver-cu12
nvidia-cuda-cupti-cu12==12.6.68
    # via jax-cuda12-plugin
nvidia-cuda-nvcc-cu12==12.6.68
    # via jax-cuda12-plugin
nvidia-cuda-runtime-cu12==12.6.68
    # via jax-cuda12-plugin
nvidia-cudnn-cu12==9.3.0.75
    # via jax-cuda12-plugin
nvidia-cufft-cu12==11.2.6.59
    # via jax-cuda12-plugin
nvidia-cusolver-cu12==11.6.4.69
    # via jax-cuda12-plugin
nvidia-cusparse-cu12==12.5.3.3
    # via jax-cuda12-plugin
    # via nvidia-cusolver-cu12
nvidia-nccl-cu12==2.22.3
    # via jax-cuda12-plugin
nvidia-nvjitlink-cu12==12.6.68
    # via jax-cuda12-plugin
    # via nvidia-cufft-cu12
    # via nvidia-cusolver-cu12
    # via nvidia-cusparse-cu12
opt-einsum==3.3.0
    # via jax
packaging==24.1
    # via matplotlib
pillow==10.4.0
    # via matplotlib
pyparsing==3.1.4
    # via matplotlib
python-dateutil==2.9.0.post0
    # via matplotlib
scipy==1.14.1
    # via jax
    # via jaxlib
six==1.16.0
    # via python-dateutil

Originally posted by @patrick-egenlauf in #1102 (comment)

The problem is not with rye. The package jax[cuda12] is not supported under MacOS and Windows.