I have a Traits/UI (chaco) plotting application, which runs fine in the root environment of my Anaconda 64-bit installation, on 64-bit Ubuntu 16.04. However, when I try to run it from a 32-bit environment, which I created for testing, it fails.
It appears to be defaulting to the "null" graphical back-end toolkit for some reason, giving me a stack trace, which ends thusly:
File "/home/dbanas/anaconda2/envs/pybert_32/lib/python2.7/site-packages/enable/toolkit.py", line 40, in _init_toolkit format_exception_only(t, v)) ImportError: Unable to import the image backend for the null toolkit (reason: ['ImportError: libGL.so.1: cannot open shared object file: No such file or directory\n']).
So, I realized that I didn't have 32-bit Gtk+ library support installed on my system. I installed that. And, now, the application segment faults when I launch it in my 32-bit environment! Here is the stack trace, from gdb:
> #0 0xf76e7f10 in ?? () from /lib/ld-linux.so.2
> #1 0xf76e8a4b in ?? () from /lib/ld-linux.so.2
> #2 0xf76ea7c9 in ?? () from /lib/ld-linux.so.2
> #3 0xf76f26bf in ?? () from /lib/ld-linux.so.2
> #4 0xf76ee204 in ?? () from /lib/ld-linux.so.2
> #5 0xf76f1f02 in ?? () from /lib/ld-linux.so.2
> #6 0xf74febf5 in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #7 0xf76ee204 in ?? () from /lib/ld-linux.so.2
> #8 0xf74ff30d in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #9 0xf74fec9e in dlopen () from /lib/i386-linux-gnu/libdl.so.2
> #10 0xf76523e6 in _PyImport_GetDynLoadFunc (fqname=0x8b72188 "PyQt4.QtCore", shortname=0x8b7218e "QtCore",
> pathname=0x8b73190 "/home/dbanas/anaconda2/envs/pybert_32/lib/python2.7/site-packages/PyQt4/QtCore.so",
>
> fp=0x8981b98) at Python/dynload_shlib.c:130
> #11 0xf7636512 in _PyImport_LoadDynamicModule (name=0x8b72188 "PyQt4.QtCore",
> pathname=0x8b73190 "/home/dbanas/anaconda2/envs/pybert_32/lib/python2.7/site-packages/PyQt4/QtCore.so",
>
> fp=0x8981b98) at ./Python/importdl.c:42
> #12 0xf76343c0 in load_module (name=0x8b72188 "PyQt4.QtCore", fp=<optimized out>,
> pathname=0x8b73190 "/home/dbanas/anaconda2/envs/pybert_32/lib/python2.7/site-packages/PyQt4/QtCore.so",
> type=3,
> loader=0x0) at Python/import.c:1937
> #13 0xf7634c43 in import_submodule (mod=0xf2b9c26c, subname=0x8b7218e "QtCore", fullname=0x8b72188 "PyQt4.QtCore")
> at Python/import.c:2725
> #14 0xf7634ebc in load_next (mod=0xf2b9c26c, altmod=0xf2b9c26c, p_name=0xff97d7fc, buf=0x8b72188 "PyQt4.QtCore",
> p_buflen=0xff97d7f8) at Python/import.c:2539
> #15 0xf76354fb in import_module_level (level=-1, fromlist=0xf2b33c8c, locals=<optimized out>, globals=0xf2b2de84,
> name=0x0) at Python/import.c:2256
> #16 PyImport_ImportModuleLevel (name=0xf2b35264 "PyQt4.QtCore", globals=0xf2b2de84, locals=0xf2b2de84,
> fromlist=0xf2b33c8c, level=-1) at Python/import.c:2312
> #17 0xf7615e76 in builtin___import__ (self=0x0, args=0xf2b352fc, kwds=0x0) at Python/bltinmodule.c:49
> #18 0xf75b6188 in PyCFunction_Call (func=0xf72cf78c, arg=0xf2b352fc, kw=0x0) at Objects/methodobject.c:85
> #19 0xf756bb9c in PyObject_Call (func=0xf72cf78c, arg=0xf2b352fc, kw=0x0) at Objects/abstract.c:2547
> #20 0xf7616454 in PyEval_CallObjectWithKeywords (func=0xf72cf78c, arg=0xf2b352fc, kw=0x0) at Python/ceval.c:4221
> #21 0xf761a8aa in PyEval_EvalFrameEx (f=0xf4ba19cc, throwflag=0) at Python/ceval.c:2624
> #22 0xf761ff25 in PyEval_EvalCodeEx (co=0xf2b361d0, globals=0xf2b2de84, locals=0xf2b2de84, args=0x0, argcount=0,
> kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3584
> ---Type <return> to continue, or q <return> to quit---
So, I just made some progress:
Making the following code change, in my Python application:
from traits.trait_base import ETSConfig
# ETSConfig.toolkit = 'qt4'
ETSConfig.toolkit = 'wx'
resulted in some helpful error messages being printed out to my console, regarding missing libraries. After several iterations of the sequence:
dpkg -S libGLU.so.1
sudo apt-get install libglu1-mesa:i386
my application came up! However, the colors of the GUI are all screwed up, and when I first launch it, I get a warning dialog with the following message:
iCCP: known incorrect sRGB profile 07:07:37
So, now, I have two questions:
- How do I fix the colors of the "wx" version?
- How do I get the "qt4" version to spit out the same sort of helpful messages about missing libraries, instead of just seg. faulting?
Aha! Installing those missing 32-bit libraries has fixed the seg. faulting, and my "qt4" version is running, as well. And, the GUI colors are correct! :)