Skip to content

undefined symbol: _ZN3c104cuda10set_deviceEa when trying to use torch_xla 2.8 #9656

@jrfonseca

Description

@jrfonseca

🐛 Bug

I've been using torch_xla 2.7 without issues, but when I try to use torch_xla 2.8 I run into undefined symbol: _ZN3c104cuda10set_deviceEa errors.

The corresponding c++filt demangled symbol name is c10::cuda::set_device(signed char)

To Reproduce

Steps to reproduce the behavior:

  1. Create a repro.sh containing:
#!/bin/sh

set -eu

# Using https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
for pyver in 3.11 3.12 3.13
do
        python$pyver -m venv .venv-py$pyver
        . .venv-py$pyver/bin/activate
        test -d "$VIRTUAL_ENV"
        uv pip install -q torch==2.8.0 'torch_xla[tpu]==2.8.0'
        pyver_major=$(python -c 'import sys; print(sys.version_info[0])')
        pyver_minor=$(python -c 'import sys; print(sys.version_info[1])')
        LD_LIBRARY_PATH=$VIRTUAL_ENV/lib/python${pyver_major}.${pyver_minor}/site-packages/torch/lib ldd -r $VIRTUAL_ENV/lib/python${pyver_major}.${pyver_minor}/site-packages/_XLAC.cpython-${pyver_major}${pyver_minor}-x86_64-linux-gnu.so
        python -c 'import torch_xla' || true
        deactivate
done
  1. Run it as
$ ./repro.sh > /dev/null
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../.venv-py3.11/lib/python3.11/site-packages/torch_xla/__init__.py", line 20, in <module>
    import _XLAC
ImportError: .../.venv-py3.11/lib/python3.11/site-packages/_XLAC.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda10set_deviceEa
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../.venv-py3.12/lib/python3.12/site-packages/torch_xla/__init__.py", line 20, in <module>
    import _XLAC
ImportError: .../.venv-py3.12/lib/python3.12/site-packages/_XLAC.cpython-312-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda10set_deviceEa
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import torch_xla
  File ".../.venv-py3.13/lib/python3.13/site-packages/torch_xla/__init__.py", line 20, in <module>
    import _XLAC
ImportError: .../.venv-py3.13/lib/python3.13/site-packages/_XLAC.cpython-313-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda10set_deviceEa

Expected behavior

torch_xla successfully imported without missing symbols errors

Environment

Additional context

This happens no matter what Python version I use.

I also tried to use the torch_xla packages from https://storage.googleapis.com/pytorch-xla-releases/wheels/tpuvm/... without success.

It seems that torch_xla packages were built against a pytorch binaries significantly different from the ones available from PyPi?

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.8 releasebugSomething isn't workinginstallPyTorch/XLA installation related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions