Conquering PyTorch's Cross-Platform Installation Hell
Building a cross-platform Python project relying on PyTorch is notoriously difficult. The author, while developing FileChat, an AI coding assistant, faced this challenge. Standard dependency management loses custom indices when creating distribution wheels, requiring manual user configuration. Leveraging PEP 508, the author specified wheel URLs for each dependency along with Python version constraints, enabling single-command installation. Windows and macOS use the default PyTorch, while Linux offers separate wheels for CPU, XPU, and CUDA hardware. Users select the appropriate optional dependency group during installation (e.g., `pip install filechat[xpu]`). Maintaining wheel URLs is simpler than managing custom indices, although it requires more upfront work.
Read more