Hi,

I happened to reproduce the problem when working on pytorch-audio.

The root cause is that pytorch is only built for one python version (now 3.13).
The following paragraph is excerpted from its d/rules:

> # [maintainer note on python version]
> # This package is built for a single version (default python3) only.
> # Extending to multiple python3 versions is not easy because
> # libtorch_python.so is coupled with a single python version.

So we would have the following layout:

/usr/lib/python3/dist-packages/torch/_C.cpython-313-x86_64-linux-gnu.so
/usr/lib/python3/dist-packages/torch/_C/_VariableFunctions.pyi
/usr/lib/python3/dist-packages/torch/_C/__init__.pyi

If you try to use torch with python 3.12, the _C.python-313-foo.so will
be ignored, thus leading to the ImportError.

So any package depending on pytroch would need to use the exactly same
version of python that pytorch uses.

Thanks,
Shengqi Chen

Reply via email to