python ete3 - failure to create pdf after Gtk warning

143 views Asked by At

I have run into a problem that I do not find any helpful information on. I am using ete3 in python to automatize the creation of phylogenetic tree figures. I have written some code that works wonderful if I execute it in my ipython notebook.

However, when I run it in the terminal via python script.py, I get the following warning message:

GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.

(python:7657): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so) initialization check failed: GLib version too old (micro mismatch)

(python:7657): Gtk-WARNING **: Loading IM context type 'ibus' failed

(python:7657): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so) initialization check failed: GLib version too old (micro mismatch)

(python:7657): Gtk-WARNING **: Loading IM context type 'ibus' failed

(python:7657): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so) initialization check failed: GLib version too old (micro mismatch)

(python:7657): Gtk-WARNING **: Loading IM context type 'ibus' failed

After the warning appears, the code is just stuck and does not create the figure.I already tried updating the glib library, but it did not help.

The code I am using is:

def my_layout(node):
    F = TextFace(node.name, tight_text=True)
    add_face_to_node(F, node, column=0, position="branch-top")
    if node.is_leaf():
        seq_face = SeqMotifFace(node.sequence, seqtype='nt', seq_format='compactseq')
        add_face_to_node(seq_face, node, column=0, position='aligned')

def phylo_with_alignment(tree, alignment, out_dir, out_format):
    t2=PhyloTree(tree, alignment)
    t2.link_to_alignment(alignment=alignment, alg_format='fasta')
    ts2=TreeStyle()
    ts2.show_leaf_name=False
    ts2.layout_fn=my_layout
    print 'trying to render...'
    t2.render(out_dir.rstrip('/')+'/'+os.path.basename(tree)+'phylo_aln.'+out_format, tree_style=ts2)
    print 'Done!'

try:
    parse_fasta(args.alignment)
    phylo_with_alignment(tree, alignment, args.out_dir, args.out_format)
    print 'Tataaaa, phylogeny with alignment created and saved to %s!' % out_dir
except Exception, e:
    print 'EXCEPTION: %s, line %s' % (e, sys.exc_info()[-1].tb_lineno)
    sys.exit()

The goal here is to create the figure and save it to out_dir. The Error occurs when I call t2.render(), before that everything runs smoothly.

Has someone an idea what I could do to fix this? I already looked at How can I fix this error? Gtk-WARNING **: GModule ... initialization check failed: GLib version too old (micro mismatch) and connected questions, but could find no answers.


EDIT:


calling conda remove glib gets rid of the error message, but the script does still not finish. NOTE: The same code is working when executed in an ipython notebook

0

There are 0 answers