#1057644 pytorch: build for all supported Python versions

Package:
src:pytorch
Source:
src:pytorch
Submitter:
Andrius Merkys
Date:
2026-01-13 19:49:00 UTC
Severity:
normal
Tags:
#1057644#5
Date:
2023-12-06 13:28:56 UTC
From:
To:
Hello,

Currently pytorch builds for the default Python version only. This
causes build failures for reverse dependencies which build for all
supported Python versions, for example python-array-api-compat and
pytorch-geometric [1].

[1] https://lists.debian.org/debian-ai/2023/12/msg00014.html

Andrius

#1057644#10
Date:
2024-01-01 04:21:03 UTC
From:
To:
I tried this and it turns to be a little bit complicated to support. The
code change can be found in the git history, which was reverted by me.
The problem is that the file libtorch_python.so.* is specific to one
python version, and cannot be shared between py3.11 and py3.12. One of
them will break if we do setup.py for both versions.

https://github.com/pytorch/pytorch/issues/56046

Upstream is not interested to fix this since libtorch_python.so is
already big enough (25MB).

I don't want to spend my time for simultaneously supporting multiple
python versions anymore. And I don't see any problem by only supporting
the default python version. A couple of lines of code change can limit
reverse dependencies to a single python version.

Patch is appreciated if anybody can make it work. Make sure that both
py3.11 and py3.12 `import torch` works correctly.

#1057644#17
Date:
2024-01-02 08:52:32 UTC
From:
To:
Hi,

Thanks a lot for giving this a shot. This means that all reverse
dependencies of pytorch will have to support default Python only.

Best wishes,
Andrius

#1057644#22
Date:
2026-01-13 16:48:51 UTC
From:
To:
That’s too bad.  This is causing problems for pyinstaller’s test suite:

https://salsa.debian.org/python-team/packages/pyinstaller-hooks-contrib/-/
jobs/8880569#L2806

#1057644#25
Date:
2026-01-13 16:48:51 UTC
From:
To:
That’s too bad.  This is causing problems for pyinstaller’s test suite:

https://salsa.debian.org/python-team/packages/pyinstaller-hooks-contrib/-/
jobs/8880569#L2806