benfred / py-spy

Sampling profiler for Python programs
MIT License
12.13k stars 401 forks source link

Python 3.12 not supported #661

Open nicolargo opened 2 months ago

nicolargo commented 2 months ago

On my fresh Ubuntu 24.04 install:

sudo env "PATH=$PATH" ./venv-dev/bin/py-spy record --pid 66778
Error: Unsupported version of Python: 3.12.0

Is it plan to support Python 3.12 ?

potoo0 commented 2 months ago

Additional debugging info (RUST_LOG=info py-spy record --pid 1182335)

[2024-04-29T02:08:16.589266775Z INFO  py_spy::config] Command line args: ArgMatches { args: {}, subcommand: Some(SubCommand { id: [hash: FA6893386E553029], name: "record", matches: ArgMatches { args: {[hash: CD5160AB4406C427]: MatchedArg { occurs: 1, source: Some(CommandLine), indices: [2], type_id: Some(TypeId { t: 15469221632486072992 }), vals: [[AnyValue { inner: TypeId { t: 15469221632486072992 } }]], raw_vals: [["1182335"]], ignore_case: false }, [hash: 66D7DFD73E3FE4B7]: MatchedArg { occurs: 0, source: Some(DefaultValue), indices: [3], type_id: Some(TypeId { t: 15469221632486072992 }), vals: [[AnyValue { inner: TypeId { t: 15469221632486072992 } }]], raw_vals: [["flamegraph"]], ignore_case: true }, [hash: BD514D8BE9BFDED6]: MatchedArg { occurs: 0, source: Some(DefaultValue), indices: [4], type_id: Some(TypeId { t: 15469221632486072992 }), vals: [[AnyValue { inner: TypeId { t: 15469221632486072992 } }]], raw_vals: [["unlimited"]], ignore_case: false }, [hash: AAFAF59EB7E2AC8]: MatchedArg { occurs: 0, source: Some(DefaultValue), indices: [5], type_id: Some(TypeId { t: 15469221632486072992 }), vals: [[AnyValue { inner: TypeId { t: 15469221632486072992 } }]], raw_vals: [["100"]], ignore_case: false }}, subcommand: None } }) }
[2024-04-29T02:08:16.596080584Z INFO  py_spy::python_spy] Got virtual memory maps from pid 1182335:
[2024-04-29T02:08:16.610942304Z INFO  py_spy::python_spy] Getting version from python binary BSS
[2024-04-29T02:08:16.611635008Z INFO  py_spy::python_spy] Failed to get version from BSS section: failed to find version string
[2024-04-29T02:08:16.611643462Z INFO  py_spy::python_spy] Trying to get version from path: /usr/local/mambaforge/envs/gpt/bin/python3.12
[2024-04-29T02:08:16.611648132Z INFO  py_spy::python_spy] python version 3.12.0 detected
[2024-04-29T02:08:16.611653183Z INFO  py_spy::python_spy] Failed to get interp_head from symbols, scanning BSS section from main binary
[2024-04-29T02:08:16.613659274Z INFO  py_spy::python_spy] Failed to connect to process, retrying. Error: Unsupported version of Python: 3.12.0
[2024-04-29T02:08:16.637244079Z INFO  py_spy::python_spy] Got virtual memory maps from pid 1182335:
[2024-04-29T02:08:16.649956194Z INFO  py_spy::python_spy] Getting version from python binary BSS
[2024-04-29T02:08:16.649970063Z INFO  py_spy::python_spy] Failed to get version from BSS section: failed to find version string
[2024-04-29T02:08:16.649974153Z INFO  py_spy::python_spy] Trying to get version from path: /usr/local/mambaforge/envs/gpt/bin/python3.12
[2024-04-29T02:08:16.649978538Z INFO  py_spy::python_spy] python version 3.12.0 detected
[2024-04-29T02:08:16.649982877Z INFO  py_spy::python_spy] Failed to get interp_head from symbols, scanning BSS section from main binary
[2024-04-29T02:08:16.651860942Z INFO  py_spy::python_spy] Failed to connect to process, retrying. Error: Unsupported version of Python: 3.12.0
[2024-04-29T02:08:16.675272893Z INFO  py_spy::python_spy] Got virtual memory maps from pid 1182335:
[2024-04-29T02:08:16.686990383Z INFO  py_spy::python_spy] Getting version from python binary BSS
[2024-04-29T02:08:16.687005220Z INFO  py_spy::python_spy] Failed to get version from BSS section: failed to find version string
[2024-04-29T02:08:16.687009988Z INFO  py_spy::python_spy] Trying to get version from path: /usr/local/mambaforge/envs/gpt/bin/python3.12
[2024-04-29T02:08:16.687013634Z INFO  py_spy::python_spy] python version 3.12.0 detected
[2024-04-29T02:08:16.687018102Z INFO  py_spy::python_spy] Failed to get interp_head from symbols, scanning BSS section from main binary
[2024-04-29T02:08:16.688877808Z INFO  py_spy::python_spy] Failed to connect to process, retrying. Error: Unsupported version of Python: 3.12.0
[2024-04-29T02:08:16.712299860Z INFO  py_spy::python_spy] Got virtual memory maps from pid 1182335:
[2024-04-29T02:08:16.723979518Z INFO  py_spy::python_spy] Getting version from python binary BSS
[2024-04-29T02:08:16.723990905Z INFO  py_spy::python_spy] Failed to get version from BSS section: failed to find version string
[2024-04-29T02:08:16.723994771Z INFO  py_spy::python_spy] Trying to get version from path: /usr/local/mambaforge/envs/gpt/bin/python3.12
[2024-04-29T02:08:16.723998152Z INFO  py_spy::python_spy] python version 3.12.0 detected

...

Error: Unsupported version of Python: 3.12.0
kakkoyun commented 2 months ago

Duplicate of #633

olejorgenb commented 1 month ago

Probably not very helpful, but https://github.com/plasma-umass/scalene and pyinstrument (both sampling profilers) support python 3.12 now. Maybe possible to get hints of how to resolve some of the issues there.

https://github.com/joerick/pyinstrument/pull/246

Couldn't find the exact commits/PR for scalene