Skip to content

MacOS 15 get_cput_info() hangs on rosetta python on Apple M1 Ultra #218

@edbarnard

Description

@edbarnard

Config

  • CPU architecture: Apple ARM (M1 Ultra) with Rosetta (x86) python
  • Operating System: macOS 15
  • Python version: 3.11.11
  • Version of py-cpuinfo: 9.0.0

cpuinfo.get_cpu_info() hangs waiting for a subprocess to return. It never does, so get_cpu_info() never returns.

Example

Python 3.11.11 (main, Dec 11 2024, 10:28:39) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cpuinfo
>>> cpuinfo.get_cpu_info()
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/esbarnard/opt/anaconda3/envs/tiled-client/lib/python3.11/site-packages/cpuinfo/cpuinfo.py", line 2759, in get_cpu_info
    output = get_cpu_info_json()
             ^^^^^^^^^^^^^^^^^^^
  File "/Users/esbarnard/opt/anaconda3/envs/tiled-client/lib/python3.11/site-packages/cpuinfo/cpuinfo.py", line 2742, in get_cpu_info_json
    output = p1.communicate()[0]
             ^^^^^^^^^^^^^^^^
  File "/Users/esbarnard/opt/anaconda3/envs/tiled-client/lib/python3.11/subprocess.py", line 1209, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/esbarnard/opt/anaconda3/envs/tiled-client/lib/python3.11/subprocess.py", line 2115, in _communicate
    ready = selector.select(timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/esbarnard/opt/anaconda3/envs/tiled-client/lib/python3.11/selectors.py", line 415, in select
    fd_event_list = self._selector.poll(timeout)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
>>> 

Tested on other computers with similar cpu and OSes:

Computer macOS python works?
M3 Macbook Air macOS 14.4 Native ARM Python 3.12 WORKS
M3 Macbook Air macOS 15.2 Native ARM Python 3.12 WORKS
M1 Ultra Mac Studio macOS 15.1.1 Rosetta Python 3.12 FAILS
M1 iMac macOS 14.6.1 Rosetta Python 3.12 WORKS
Intel i9 MacBook Pro macOS 15.0 Native x86 Python 3.12 WORKS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions