-
BackgroundI'm using PDM to manage my Python project dependencies and recently encountered an issue when installing PyTorch with CUDA support. My configuration is as follows: [[tool.pdm.source]]
name = "private-pypi"
url = "https://download.pytorch.org/whl/cu121"
include_packages = ["torch", "torchvision", "torchaudio"] However, every time I run
This leads to a significant increase in the download size and drastically extends the time required for installations or updates, especially on slower networks. WorkaroundI came across a solution on StackOverflow, which suggested modifying the PDM configuration like this: [tool.pdm.resolution]
# Prevent unnecessary runtime libraries from being installed
excludes = [
"nvidia-cublas-cu12",
"nvidia-cuda-cupti-cu12",
"nvidia-cuda-nvrtc-cu12",
"nvidia-cuda-runtime-cu12",
"nvidia-cudnn-cu12",
"nvidia-cufft-cu12",
"nvidia-curand-cu12",
"nvidia-cusolver-cu12",
"nvidia-cusparse-cu12",
"nvidia-nccl-cu12",
"nvidia-nvtx-cu12",
"triton",
] This indeed resolves the issue by preventing the unnecessary re-download of these libraries. However, I'm unsure whether excluding these runtime libraries could introduce any risks or problems when running or updating PyTorch. Questions for the Community
Additional Details
I'm looking forward to hearing your insights or experiences on this topic. Thanks in advance for any advice or suggestions! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The downloads is because the torch index doesn't contain necessary metadata in the HTML content. It can be only retrieved by downloading the file to disk. Plus, you are locking for all platforms so these linux-only dependencies will also be analyzed even not needed on your platform(Windows). One potential downside is that if you are to deploy the app on Linux platform, since they are excluded from the private index, they will be pulled from PyPI instead. Therefore, if you are sure this lock will never work on platforms other than Windows, just restrict the platform by |
Beta Was this translation helpful? Give feedback.
The downloads is because the torch index doesn't contain necessary metadata in the HTML content. It can be only retrieved by downloading the file to disk. Plus, you are locking for all platforms so these linux-only dependencies will also be analyzed even not needed on your platform(Windows).
One potential downside is that if you are to deploy the app on Linux pla…