# PyTorch mirror (pkg.shecan.ir)

> Mirror of the official PyTorch wheel indexes (download.pytorch.org/whl/<variant>: cpu, cu126, cu128, cu130, rocm6.4, xpu, ...) for pip and uv, including the CUDA libraries from pypi.nvidia.com that the cu* indexes link to.

- Upstream: download.pytorch.org, pypi.nvidia.com
- Mirror URLs: <https://mirror-pytorch.pkg.shecan.ir/whl/cpu>, <https://mirror-pytorch.pkg.shecan.ir/whl/cu126>
- Clients: pip, uv
- Service status: <https://pkg.shecan.ir/status.json> (key `pytorch`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/pytorch/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/pytorch.json>

## Limitations

- Replace cpu in the URL with the variant shown on pytorch.org (cu126, cu128, cu130, rocm6.4, xpu, ...).
- Use it together with mirror-pypi (pip --extra-index-url, uv: a default index plus an explicit PyTorch index) so that other packages come from PyPI.
- Nightly and test indexes (/whl/nightly/, /whl/test/) and LibTorch archives are not mirrored.
- Files of 3 GB or more (ROCm torch wheels) are downloaded through the mirror but not cached.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### pip: temporary (one command or the current shell; nothing saved)

Run

```sh
pip install torch torchvision torchaudio --index-url https://mirror-pytorch.pkg.shecan.ir/whl/cpu --extra-index-url https://mirror-pypi.pkg.shecan.ir/simple/
```

### pip: project (files inside the project)

Configuration file: `requirements.txt`

```
--index-url https://mirror-pytorch.pkg.shecan.ir/whl/cpu
--extra-index-url https://mirror-pypi.pkg.shecan.ir/simple/
torch
```

### uv: project (files inside the project)

Configuration file: `pyproject.toml`

```toml
[[tool.uv.index]]
url = "https://mirror-pypi.pkg.shecan.ir/simple/"
default = true

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://mirror-pytorch.pkg.shecan.ir/whl/cpu"
explicit = true

[tool.uv.sources]
torch = [{ index = "pytorch-cpu" }]
```

### uv: temporary (one command or the current shell; nothing saved)

Run

```sh
uv pip install --system torch --default-index https://mirror-pypi.pkg.shecan.ir/simple/ --index https://mirror-pytorch.pkg.shecan.ir/whl/cpu
```
