evanhempel / python-flamegraph

Statistical profiler which outputs in format suitable for FlameGraph (http://www.brendangregg.com/flamegraphs.html)
The Unlicense
393 stars 55 forks source link

/usr/bin/python: No module named flamegraph #19

Open Miaoishappening opened 2 years ago

Miaoishappening commented 2 years ago

i cannot start it because No module named flamegraph.

but i have installed: pip install git+https://github.com/evanhempel/python-flamegraph.git

'''pip install git+https://github.com/evanhempel/python-flamegraph.git Collecting git+https://github.com/evanhempel/python-flamegraph.git Cloning https://github.com/evanhempel/python-flamegraph.git to /tmp/pip-req-build-0o57y8hm Running command git clone -q https://github.com/evanhempel/python-flamegraph.git /tmp/pip-req-build-0o57y8hm /home/yiwei/.local/lib/python3.8/site-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release warnings.warn( /home/yiwei/.local/lib/python3.8/site-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 1.13.1-unknown is an invalid version and will not be supported in a future release warnings.warn( /home/yiwei/.local/lib/python3.8/site-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release warnings.warn( Building wheels for collected packages: flamegraph Building wheel for flamegraph (setup.py) ... done Created wheel for flamegraph: filename=flamegraph-0.1-py3-none-any.whl size=5793 sha256=29005f3f6de44d87677934b3929f9ff5f527d75c4e229a204d17d24b7bde124e Stored in directory: /tmp/pip-ephem-wheel-cache-x0ptsvmg/wheels/ef/34/64/fb50a5c67924972e8361d0641f1f1b56fa9f1ff8daad2550bb Successfully built flamegraph Installing collected packages: flamegraph Successfully installed flamegraph-0.1 '''

what can i do here?

aaronweissler commented 2 years ago

Hi @Miaoishappening,

I can not help you directly with your problem, I just wanted to chime in that with Python 3.8 this profiler does not work in general due to #18 and you'd have to use a version with the fix from #17, e. g. the fork at https://github.com/rossmcdonald/python-flamegraph. Installing that did work for me right away in Python 3.9. However, I've been looking at a lot of different Python profilers recently, and to be honest I'd recommend simply using a different one in the first place, for flamegraphs py-spy could be a good alternative due to it being actively maintained, having a bigger community and being more advanced in terms of features.

Best wishes, Aaron