Painter not active

1,443 views
Skip to first unread message

J.R. W

unread,
Nov 6, 2015, 9:00:25 PM11/6/15
to The ETE toolkit
Hi,

tree.render() was working for me. But all of the sudden, I'm getting the following using ipython notebook.

tree.render("%%inline")

"
QPainter::setBrush: Painter not active                                                             QPainter::restore: Unbalanced save/restore
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::drawPath: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setWorldTransform: Painter not active
"

If I try to use 

tree.render("file.png")

It seems to dump the file to a cell as a JSON without actually outputting the file. Does anyone have any suggestions? Googling around gives virtually nothing.

Jordan





Jordan Willis

unread,
Nov 6, 2015, 9:21:15 PM11/6/15
to eteto...@googlegroups.com
Interestingly, the tree.show method works.

Jordan
--
You received this message because you are subscribed to a topic in the Google Groups "The ETE toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/etetoolkit/aLDmZJ8mXjo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to etetoolkit+...@googlegroups.com.
To post to this group, send email to eteto...@googlegroups.com.
Visit this group at http://groups.google.com/group/etetoolkit.
For more options, visit https://groups.google.com/d/optout.

Jaime Huerta Cepas

unread,
Nov 7, 2015, 3:47:51 AM11/7/15
to eteto...@googlegroups.com
Hi Jordan, 
I cannot reproduce the problem. Did you upgrade anything in your system? Could you provide some info about versions? 

import ete2
from PyQt4.QtCore import QT_VERSION_STR
print QT_VERSION_STR
print ete2.__version__


--
You received this message because you are subscribed to the Google Groups "The ETE toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etetoolkit+...@googlegroups.com.

Jordan Willis

unread,
Nov 7, 2015, 3:56:59 AM11/7/15
to eteto...@googlegroups.com
Hi Jaime,

In [1]: import ete2


In [2]: from PyQt4.QtCore import QT_VERSION_STR

In [3]: print QT_VERSION_STR
4.8.6

In [4]: print ete2.__version__
2.3.9

I’m the sys admin and I haven’t updated anything. Is there another way to output files that I can test rather than tree.render() to test a work around?

Jordan

Jaime Huerta Cepas

unread,
Nov 7, 2015, 4:05:02 AM11/7/15
to eteto...@googlegroups.com
tree.render and tree.show are the two only options. 
Does the code run as a regular python script from the command line? i.e. replacing 'tree.render("%%inline")' by tree.render("test.png")

Jordan Willis

unread,
Nov 7, 2015, 4:14:54 AM11/7/15
to eteto...@googlegroups.com
Indeed, 

tree.render() will run in a script if I put a file name in there. I’m not sure why tree.render just dumps a json (json looking object, possible dictionary) if I do tree.render in python notebook. I would not be so adamant about it working in python notebook if I didn’t have so many R functions using ipython magic.  

Jordan

Jaime Huerta Cepas

unread,
Nov 7, 2015, 4:22:23 AM11/7/15
to eteto...@googlegroups.com
tree render produces the image and returns a json with a map of cordinates of nodes in the image, that's normal (used  i.e. for html maps)

You need the %%inline or %%inlineSVG special flag for inline Ipython, and this is working for me (and I understand it was also working in your case). 

Can you try the ete 2.3.10 upgrade? I cannot think of any change there related to this, but just to make sure. 

What's your version of Ipython notebook? I may try to test under the same  

Jaime Huerta Cepas

unread,
Nov 7, 2015, 4:26:27 AM11/7/15
to eteto...@googlegroups.com
try also with "%%inlineSVG", which goes through a different route.
 let's see if can corner the problem...

Jordan Willis

unread,
Nov 7, 2015, 4:29:36 AM11/7/15
to eteto...@googlegroups.com
Hi Jaime,

$ipython --version ; python --version
3.2.0
Python 2.7.10 :: Anaconda 2.3.0 (64-bit)

Jaime Huerta Cepas

unread,
Nov 7, 2015, 4:45:57 AM11/7/15
to eteto...@googlegroups.com
Just tried with ipython 3.2.0, and still working. 
I see you are using anaconda, you didn't upgrade/install any package recently? It is very strange that it stopped working suddenly.

This is my current anaconda dsitribution of packages:

$ conda list qt
# packages in environment at /Users/jhc/anaconda:
#
ipython-qtconsole         3.2.0                    py27_0
pyqt                      4.11.4                   py27_0
qt                        4.8.7                         1

$ conda list ipython
# packages in environment at /Users/jhc/anaconda:
#
ipython                   4.0.0                    py27_1
ipython-genutils          0.1.0                     <pip>
ipython-notebook          3.2.0                    py27_0
ipython-qtconsole         3.2.0                    py27_0
ipython_genutils          0.1.0                    py27_0

Jaime Huerta Cepas

unread,
Nov 8, 2015, 2:25:27 AM11/8/15
to Jordan Willis, eteto...@googlegroups.com
Thanks Jordan, 
yes, that's indeed the problem. PNG is limited by size, so either you split large trees into several subtrees or use PDF or SVG output.  For IPython notebook integration, '%%inlineSVG' should be fine. 

The error is actually at the Qt4 level, but I I guess ete could predict when this is going to occur and report a more informative error. Thanks again for reporting it
-jaime

On 8 November 2015 at 02:48, Jordan Willis <jwill...@gmail.com> wrote:
I spoke too soon.

The problem seems to be with huge trees. I think python notebook chokes on memory with those huge trees. However, “%%inlineSVG” works even with those huge trees, although it is so zoomed in, you can’t really see anything.

The problem with rendering to a image was that I was using .png. If i use .pdf or .svg it will output the image though. Should ete give an error when you try and use .png on a large tree? Seems for now, problem is solved.

Thanks,
Jordan


On Nov 7, 2015, at 1:49 AM, Jaime Huerta Cepas <jhc...@gmail.com> wrote:

Hi Jordan, 
Could I see the exact code you are using for testing?

Reply all
Reply to author
Forward
0 new messages