sudo yum install valgrind kcachegrind
and pyprof2calltree:
pip install pyprof2calltree
python -m cProfile -o profile_data.pyprof run.py
# this converts the stats into a callgrind format
pyprof2calltree -i profile_data.pyprof
kcachegrind profile_data.pyprof.log
Alternatively, for visualisation, you can also use gprof2dot and graphviz (dot):
gprof2dot.py --format=callgrind --output=out.dot profile_data.pyprof.log
dot -Tsvg out.dot -o graph.svg