benfred / py-spy

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

py-spy fails to find native source files when package installed as "development" option #551

Open gobater opened 1 year ago

gobater commented 1 year ago

I'm developing a mixed (C and PY) python extension.

In order to speed up development, I do install the PY files into site-packages of my venv: so I use pip install -e .. If I do so, py-spy fails to follow the link to the (C) source files and the symbols of my native code are not displayed in the flamegraph

andryandrew commented 1 year ago

I had a similar problem, and I solved it by adding --no-build-isolation and --no-deps to the pip install such that the compilation of your package relies on the C modules actually installed in your venv (which I imagine you compiled with debug symbols) instead of re-building everything in a sandbox. If you do this, you should pre-install everything that is required.