Skip to content

ImportError on macOS Apple Silicon (arm64): Architecture mismatch in s_gd2 when importing T-PHATE #9

Description

@jesuinovieira

I’m trying to use T-PHATE on an Apple Silicon (M3) machine, but I’m running into an architecture mismatch when the package tries to import the s_gd2 dependency. Python is running natively as arm64, but the import attempts to load an x86_64 shared library, which leads to a failure.

Environment

  • OS: macOS 15 (Apple Silicon M3)
  • Python: 3.11.3

Traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../site-packages/tphate/__init__.py", line 1, in <module>
    from .tphate import TPHATE
  File ".../site-packages/tphate/tphate.py", line 2, in <module>
    from . import graphs, utils, base, vne, mds
  File ".../site-packages/tphate/mds.py", line 11, in <module>
    import s_gd2
  File ".../site-packages/s_gd2/__init__.py", line 1, in <module>
    from .s_gd2 import *
  File ".../site-packages/s_gd2/s_gd2.py", line 1, in <module>
    from .swig import layout as cpp
  File ".../site-packages/s_gd2/swig/layout.py", line 21, in <module>
    _layout = swig_import_helper()
              ^^^^^^^^^^^^^^^^^^^^
  File ".../site-packages/s_gd2/swig/layout.py", line 19, in swig_import_helper
    return importlib.import_module("_layout")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: dlopen(.../_layout.cpython-311-darwin.so, 0x0002): tried: '.../_layout.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/.../_layout.cpython-311-darwin.so' (no such file), '.../_layout.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

Has anyone run into this issue? I also tried building s_gd2 from source, but ended up with the same error.

I opened an issue in the s_gd2 repo but it seems not maintained anymore.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions