benfred / py-spy

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

Error: Failed to find python version from target process #550

Open kDaeMN opened 1 year ago

kDaeMN commented 1 year ago

Getting below stack when trying to use py-spy on

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

Python 2.7.18

py-spy 0.3.14

INFO 2023-02-04T14:36:42Z: py_spy::python_spy: Found libpython binary @ /opt/XX/YYY/lib/libpython2.7.so.1.0 INFO 2023-02-04T14:36:42Z: py_spy::python_spy: Getting version from python binary BSS INFO 2023-02-04T14:36:42Z: py_spy::python_spy: Failed to get version from BSS section: failed to find version string INFO 2023-02-04T14:36:42Z: py_spy::python_spy: Getting version from libpython BSS INFO 2023-02-04T14:36:42Z: py_spy::python_spy: Failed to get version from libpython BSS section: failed to find version string INFO 2023-02-04T14:36:42Z: py_spy::python_spy: Trying to get version from path: /opt/XX/YYY/lib/EXECUTABLENAME Error: Failed to find python version from target process

gobater commented 1 year ago

There is a similar bug: https://github.com/benfred/py-spy/issues/550

This problem also occurs on windows when calling a module entry point (executable) instead of directly calling the python interpreter

itamarst commented 1 year ago

I am seeing this on a bunch of module entry point executables on Python 3.10 on Windows, as above. Austin does manage to do it, so I assume it's possible.

ses4j commented 1 year ago

Be aware --subprocesses may help if you're using a venv, but doesn't help with 3.10+

fleimgruber commented 6 months ago

@gobater I assume you meant to link to this similar bug: https://github.com/benfred/py-spy/issues/498?

gobater commented 6 months ago

@gobater I assume you meant to link to this similar bug: #498?

Yes, you are correct. I mixed it up while c&p the link