py-spy icon indicating copy to clipboard operation
py-spy copied to clipboard

Error: Failed to find a python interpreter in the .data section

Open olumide-x opened this issue 1 year ago • 3 comments

I am running py-spy (version. 0.3.14) on the following simple example (from the GTK python docs) as follows

py-spy record -- python test.py

on Windows. The application ran for a short while but then crashes with the error

`Error: Failed to find a python interpreter in the .data section`

olumide-x avatar Aug 12 '24 16:08 olumide-x

Same for me on Windows 11 and Python 3.11.9

PS C:\Users\jairo> py-spy top --pid 6516
[2024-09-26T21:34:56.591592500Z INFO  py_spy::config] Command line args: ArgMatches { args: {}, subcommand: Some(SubCommand { id: [hash: 94BC6A87CFA2B1F9], name: "top", matches: ArgMatches { args: {[hash: CD5160AB4406C427]: MatchedArg { occurs: 1, source: Some(CommandLine), indices: [2], type_id: Some(TypeId { t: 8220707328025750160 }), vals: [[AnyValue { inner: TypeId { t: 8220707328025750160 } }]], raw_vals: [["6516"]], ignore_case: false }, [hash: AAFAF59EB7E2AC8]: MatchedArg { occurs: 0, source: Some(DefaultValue), indices: [3], type_id: Some(TypeId { t: 8220707328025750160 }), vals: [[AnyValue { inner: TypeId { t: 8220707328025750160 } }]], raw_vals: [["100"]], ignore_case: false }}, subcommand: None } }) }
[2024-09-26T21:34:56.593518800Z INFO  py_spy::python_spy] Got virtual memory maps from pid 6516:
[2024-09-26T21:34:56.594659600Z INFO  py_spy::python_spy] Found libpython binary @ C:\Users\jairo\AppData\Local\Programs\Python\Python311\python311.dll
[2024-09-26T21:34:56.598030500Z INFO  py_spy::python_spy] Getting version from python binary BSS
[2024-09-26T21:34:56.598683000Z INFO  py_spy::python_spy] Failed to get version from BSS section: failed to find version string
[2024-09-26T21:34:56.598761000Z INFO  py_spy::python_spy] Getting version from libpython BSS
[2024-09-26T21:34:56.599668500Z INFO  py_spy::version] Found matching version string '3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit'
[2024-09-26T21:34:56.599843400Z INFO  py_spy::python_spy] python version 3.11.9 detected
[2024-09-26T21:34:56.599977800Z INFO  py_spy::python_spy] got symbol _PyRuntime (0x00007ffb82137600) from libpython binary
[2024-09-26T21:34:56.600279800Z WARN  py_spy::python_spy] Interpreter address from _PyRuntime symbol is invalid 0000000000000000
[2024-09-26T21:34:56.600387100Z INFO  py_spy::python_spy] Failed to get interp_head from symbols, scanning BSS section from main binary
[2024-09-26T21:34:56.608448500Z INFO  py_spy::python_spy] Failed to get interpreter from binary BSS, scanning libpython BSS
[2024-09-26T21:34:58.338916400Z INFO  py_spy::python_spy] Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section

Also on Windows 11 and Python 3.10.0

PS C:\Users\jairo> py-spy top --pid 15988
[2024-09-26T21:54:26.535191700Z INFO  py_spy::config] Command line args: ArgMatches { args: {}, subcommand: Some(SubCommand { id: [hash: 94BC6A87CFA2B1F9], name: "top", matches: ArgMatches { args: {[hash: CD5160AB4406C427]: MatchedArg { occurs: 1, source: Some(CommandLine), indices: [2], type_id: Some(TypeId { t: 8220707328025750160 }), vals: [[AnyValue { inner: TypeId { t: 8220707328025750160 } }]], raw_vals: [["15988"]], ignore_case: false }, [hash: AAFAF59EB7E2AC8]: MatchedArg { occurs: 0, source: Some(DefaultValue), indices: [3], type_id: Some(TypeId { t: 8220707328025750160 }), vals: [[AnyValue { inner: TypeId { t: 8220707328025750160 } }]], raw_vals: [["100"]], ignore_case: false }}, subcommand: None } }) }
[2024-09-26T21:54:26.537111000Z INFO  py_spy::python_spy] Got virtual memory maps from pid 15988:
[2024-09-26T21:54:26.538560100Z INFO  py_spy::python_spy] Found libpython binary @ C:\Users\jairo\AppData\Local\Programs\Python\Python310\python310.dll
[2024-09-26T21:54:26.541912200Z INFO  py_spy::python_spy] Getting version from python binary BSS
[2024-09-26T21:54:26.542565500Z INFO  py_spy::python_spy] Failed to get version from BSS section: failed to find version string
[2024-09-26T21:54:26.542667900Z INFO  py_spy::python_spy] Getting version from libpython BSS
[2024-09-26T21:54:26.543033600Z INFO  py_spy::version] Found matching version string '3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit'
[2024-09-26T21:54:26.543172000Z INFO  py_spy::python_spy] python version 3.10.0 detected
[2024-09-26T21:54:26.543245800Z INFO  py_spy::python_spy] got symbol _PyRuntime (0x00007ffb80e34800) from libpython binary
[2024-09-26T21:54:26.543480000Z WARN  py_spy::python_spy] Interpreter address from _PyRuntime symbol is invalid 0016c0d4003c2bd8
[2024-09-26T21:54:26.543596500Z INFO  py_spy::python_spy] Failed to get interp_head from symbols, scanning BSS section from main binary
[2024-09-26T21:54:26.552387400Z INFO  py_spy::python_spy] Failed to get interpreter from binary BSS, scanning libpython BSS
[2024-09-26T21:54:27.015787500Z INFO  py_spy::python_spy] Failed to connect to process, retrying. Error: Failed to find a python interpreter in the .data section

jairov4 avatar Sep 26 '24 21:09 jairov4

may be is any page indicating which version of python works?

jairov4 avatar Sep 26 '24 21:09 jairov4

I found it works on Python 3.9 on windows but unfortunately it is useless for my case, my project use python 3.11 syntax :(

jairov4 avatar Sep 26 '24 22:09 jairov4

This should be fixed by https://github.com/benfred/py-spy/pull/718 -

benfred avatar Oct 31 '24 21:10 benfred

I think this should be fixed in the 0.4 release. Can you try it out and let me know?

If this is still not working please re-open the issue

benfred avatar Nov 01 '24 21:11 benfred