Skip to content

[RFC] Generic CI job with UV support #6010

@atalman

Description

@atalman

Currently we are trying to Migrate off Conda see : pytorch/pytorch#138506

In Test infra repo gives user ability to run Generic CI Jobs that have conda installed:
https://github.com/pytorch/test-infra/wiki/Writing-generic-CI-jobs

These Are:
https://github.com/pytorch/test-infra/blob/main/.github/workflows/linux_job.yml - (Manylinux2014 based)
https://github.com/pytorch/test-infra/blob/main/.github/workflows/linux_job_v2.yml - (Manylinux2.28 based)
https://github.com/pytorch/test-infra/blob/main/.github/workflows/macos_job.yml
https://github.com/pytorch/test-infra/blob/main/.github/workflows/windows_job.yml

By Default these include Conda installation. I would like to propose POC project https://github.com/pytorch/test-infra/blob/main/.github/workflows/linux_job_v3.yml which pre-installs uv instead of conda. This way we can use it as a test project to see if this is something Ecosystem Libraries will benefit from.

Advantages claimed by uv from https://docs.astral.sh/uv/:

  • A single tool to replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more.
  • 10-100x faster than pip.
  • Supports macOS, Linux, and Windows. (We don't run Docker on MacOS and Windows, hence uv can be used as encapsulation method, where originally conda was used)
    etc...

Simple uv workflow installing PyTorch:

curl -LsSf https://astral.sh/uv/install.sh | sh
(or using pip install uv)

uv venv py312  --python 3.12
source py312/bin/activate
uv pip install torch --pre --index-url https://download.pytorch.org/whl/nightly/cu124 --reinstall
Using Python 3.12.7 environment at: /py312
Resolved 24 packages in 480ms
Prepared 24 packages in 25.75s
Installed 24 packages in 212ms
 + filelock==3.16.1
 + fsspec==2024.10.0
 + jinja2==3.1.4
 + markupsafe==2.1.5
 + mpmath==1.3.0
 + networkx==3.4.2
 + nvidia-cublas-cu12==12.4.5.8
 + nvidia-cuda-cupti-cu12==12.4.127
 + nvidia-cuda-nvrtc-cu12==12.4.127
 + nvidia-cuda-runtime-cu12==12.4.127
 + nvidia-cudnn-cu12==9.1.0.70
 + nvidia-cufft-cu12==11.2.1.3
 + nvidia-curand-cu12==10.3.5.147
 + nvidia-cusolver-cu12==11.6.1.9
 + nvidia-cusparse-cu12==12.3.1.170
 + nvidia-cusparselt-cu12==0.6.2
 + nvidia-nccl-cu12==2.21.5
 + nvidia-nvjitlink-cu12==12.4.127
 + nvidia-nvtx-cu12==12.4.127
 + pytorch-triton==3.2.0+git35c6c7c6
 + setuptools==70.2.0
 + sympy==1.13.1
 + torch==2.6.0.dev20241204+cu124
 + typing-extensions==4.12.2
(py312) [root@baa8f3f4ffa0 /]# python
Python 3.12.7 (main, Oct 16 2024, 04:37:19) [Clang 18.1.8 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
/py312/lib/python3.12/site-packages/torch/_subclasses/functional_tensor.py:275: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.)
  cpu = _conversion_method_template(device=torch.device("cpu"))
>>> torch.__version__
'2.6.0.dev20241204+cu124'

cc @seemethere @malfet @kit1980 @huydhn @afrittoli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions