runsnake broken?

39 views
Skip to first unread message

Martin R

unread,
Mar 6, 2020, 6:25:40 AM3/6/20
to sage-devel
Dear all!

I need the call graph from a profile, and wanted to use runsnake, but it appears to be broken.

There are at least two tickets on this, https://trac.sagemath.org/ticket/14414 and https://trac.sagemath.org/ticket/17735, but neither merges.

Has anybody used runsnake recently?

(I tried both on 2.7 and 3.7 based sage

Martin

E. Madison Bray

unread,
Mar 6, 2020, 7:29:23 AM3/6/20
to sage-devel
I don't think there's much special about runsnake in this regard--it
just uses Python's builin cProfile/pstats modules. The question is
first whether or not plain pstats works.
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/2f62a61b-a304-47f8-b0cf-4aa59b552bea%40googlegroups.com.

E. Madison Bray

unread,
Mar 6, 2020, 7:37:38 AM3/6/20
to sage-devel
I don't have runsnakerun installed right now, but I tried with
snakeviz [1] and didn't have any particular problems (other than it
being very slow on load on Firefox just due to the size of the stats
data). runsnakerun will probably be more performant. Can you explain
a specific problem you had? "It appears to be broken" doesn't help.

[1] https://jiffyclub.github.io/snakeviz/

E. Madison Bray

unread,
Mar 6, 2020, 9:36:12 AM3/6/20
to sage-devel
I was able to get runsnake to work by installing it into SAGE_LOCAL,
along with a wxPython also built and installed against the Python in
SAGE_LOCAL. This turned out to be a bit of a pain in the ass (for
wxPython) mostly. This is because by default wxPython tries to build
its own copy of wxWidgets instead of using the system library, and it
can wind up with various incompatibilities. It's possible to disable
this but not easy enough, so I'll likely be submitting a patch to
wxPython for this.

On Ubuntu Bionic I did the following:

First I installed some build dependencies for wxPython:

$ sudo apt-get install libgtk-3-dev libwxgtk3.0-gtk3-dev
libwxgtk-media3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev

Installing wxPython should be possible with pip, but it isn't right
now if you want to prevent it from building its own wxWidgets.
Instead I used pip just to download and extract the source tarball:

$ mkdir tmp
$ python3 -m pip download -b tmp/ wxPython
$ cd tmp/wxPython

Apply the following patch to `setup.py` (this is the main problem--it
should be possible to pass this and other flags at the command-line,
but since it isn't we need to patch it =_=):

--- setup.py.orig 2020-03-06 15:20:07.843216794 +0100
+++ setup.py 2020-03-06 15:20:32.315063326 +0100
@@ -128,7 +128,8 @@
'message and the wxWidgets and Phoenix build steps in
the future.\n')

# Use the same Python that is running this script.
- cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'build']
+ cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'build',
+ '--use_syswx']
cmd = ' '.join(cmd)
runcmd(cmd)

Now it should work, if you have all the build dependencies and a
working wxWidgets to run:

$ python3 -m pip install -v .

Finally, install runsnake

$ python3 -m pip install runsnakerun

Ensure your `runsnake` is the one in SAGE_LOCAL:

$ which runsnake

If so, go ahead and start it. Loading the stat file produced by
cProfile should work.
Reply all
Reply to author
Forward
0 new messages