python-poetry / python-poetry/poetry

Changing a torch-installation from cu124 to cu126 removes required dependencies

Open
#10,152 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Description

Switching from torch-2.x.x+cu124 to torch-2.x.x+cu126 removes important package dependencies in the lock file, which consequently leads to failures during execution. For reproducibility, one can use the pyproject.toml-file below once with x = 4 (i.e. cu124) and once with x = 6 (i.e. cu126). Using x = 4 results in the following poetry.lock-file:

poetry_124.lock.txt

Changing to x = 6 results in
poetry_126.lock.txt

In the latter, the additional nvidia-*-dependencies and triton are missing for torch in the poetry.lock-file. Somehow, poetry does not take these dependencies into account, and therefore removes them, even though they're found in the METADATA-file.

Workarounds

None known until now

Poetry Installation Method

pipx

Operating System

Observed on Win11 and Ubuntu 24.04

Poetry Version

1.8.5

Poetry Configuration
cache-dir = "C:\\Users\\~\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
repositories.pytorch.url = "https://download.pytorch.org/whl/cu126"
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\~\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true
Python Sysconfig
Example pyproject.toml
[tool.poetry]
name = "torch-debug"
version = "0.1.0"
description = ""
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
torchvision = { version = "^0.21.0+cu12x", source = "pytorch" }
torch = { version = "^2.6.0+cu12x", source = "pytorch" }
torchaudio = { version = "^2.6.0+cu12x", source = "pytorch" }

[[tool.poetry.source]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu12x"
priority = "explicit"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Poetry Runtime Logs

Log files for poetry -vvv lock are attached, both for the switch from cu124 to cu126 (switch_124_126.log) and back (switch_124_126.log).

switch_124_126.log
switch_126_124.log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided pyproject.toml and reproduce the cu124-to-cu126 switch using Poetry 1.8.5. Compare the attached poetry.lock files and read the switch_124_126.log and switch_126_124.log to trace dependency resolution. Done means the lock file retains the required nvidia-* dependencies and triton after switching CUDA variants, with the reported execution failures addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.