benfred / py-spy

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

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

Open secsilm opened 1 year ago

secsilm commented 1 year ago

I got the Error: Failed to find a python interpreter in the .data section error when I run sudo env "PATH=$PATH" RUST_LOG=debug py-spy record -o profile.svg --pid 40067.

Here is the full log.

Here is my environment:

benfred commented 1 year ago

How did you install the python you are trying to profile ?

Atleago commented 1 year ago

Not the reporter, and we're on Windows here:


Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print(sys.version)
3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]

This python is downloaded from www.python.org, installed via PyCharm.

py-spy is installed through pip.

> py-spy.exe --version
py-spy 0.3.14
secsilm commented 1 year ago

How did you install the python you are trying to profile ?

Sorry for late reply. I install the python and pip by:

sudo apt install python3.8
sudo apt install python3-pip
python3.8 -m pip install pip
martin-kokos commented 1 year ago

Same error here. command py-spy record -o profile.svg -- python ccdata.py

My environment:

compiled with: x86_64-pc-linux-gnu-gcc -c -Wsign-compare -DNDEBUG -O3 -pipe -march=tigerlake -fwrapv -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -I/usr/include/ncursesw -fPIC -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c

space-nuko commented 1 year ago

Same error, my program (https://github.com/AUTOMATIC1111/stable-diffusion-webui) seems to run the first few lines and then it gives up later, it ends up spawning subprocesses (pip) to install dependencies

# py-spy top -- %PYTHON% launch.py --skip-install
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Commit hash: 8e439067bc6d197b4b672438a0ca6114d3cc7a6c
Installing sd-dynamic-prompts requirements.txt

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

EDIT: Fixed it, issue was I didn't install my python with debugging symbols (.pdbs). When you launch the Python installer it gives you the option to download them under "Custom Install". Reading the docs, if py-spy doesn't detect the .pdb it tries to scan the binary for whatever it needs, fruitlessly

notwopr commented 1 year ago

Same error, my program (https://github.com/AUTOMATIC1111/stable-diffusion-webui) seems to run the first few lines and then it gives up later, it ends up spawning subprocesses (pip) to install dependencies

# py-spy top -- %PYTHON% launch.py --skip-install
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Commit hash: 8e439067bc6d197b4b672438a0ca6114d3cc7a6c
Installing sd-dynamic-prompts requirements.txt

Error: Failed to find a python interpreter in the .data section
  • Windows Server 2022
  • Python 3.10.9
  • py-spy 0.3.14 (pip)

EDIT: Fixed it, issue was I didn't install my python with debugging symbols (.pdbs). When you launch the Python installer it gives you the option to download them under "Custom Install". Reading the docs, if py-spy doesn't detect the .pdb it tries to scan the binary for whatever it needs, fruitlessly

thank you for this. i had the same .data error. i just reinstalled python with the symbols and it works now. Thank you!

jkriegshauser commented 1 year ago

I too was having this same issue on Windows with a custom built python 3.10 binary running embedded in a very large application. Once I dropped the symbols alongside the DLL it worked like a charm!

As a suggestion, it might be good to log about missing symbols with this error