[Biopython-dev] Enhancements to Phylo.draw; pyplot best practices

Peter Cock p.j.a.cock at googlemail.com
Mon Apr 16 11:20:59 EDT 2012


On Sat, Apr 7, 2012 at 7:42 PM, Eric Talevich <eric.talevich at gmail.com> wrote:
> On Wed, Apr 4, 2012 at 10:53 PM, Eric Talevich <eric.talevich at gmail.com>wrote:
>
>> Hi all,
>>
>> I'm considering some enhancements to the Phylo.draw function to make it
>> more customizable for power users. Since the function is based on
>> matplotlib/pylab/pyplot, it's possible for quite a bit to be left to the
>> user; however, I'm not fully versed in what pyplot is capable of.
>>
>> Relevant feature request in Redmine:
>> https://redmine.open-bio.org/issues/3336
>>
>> Ideas:
>
> [...]
>
> Just committed this feature:
> https://github.com/biopython/biopython/commit/72990549a1b769ab19ab0bd33a8c35fdf031ac2d

Hi Eric,

That seems to have caused a test failure on one of our buildslaves:

======================================================================
ERROR: Run the tree layout algorithm, but don't display it.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildslave/BuildBot/lin2664/build/Tests/test_Phylo_depend.py",
line 51, in test_draw
    Phylo.draw(dollo, do_show=False)
  File "/home/buildslave/BuildBot/lin2664/build/build/lib.linux-x86_64-2.6/Bio/Phylo/_utils.py",
line 366, in draw
    fig = plt.figure()
  File "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py",
line 270, in figure
    **kwargs)
  File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py",
line 120, in new_figure_manager
    backend_wx._create_wx_app()
  File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_wx.py",
line 1377, in _create_wx_app
    wxapp = wx.PySimpleApp()
  File "/usr/local/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 8078, in __init__
    wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)
  File "/usr/local/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7946, in __init__
    raise SystemExit(msg)
SystemExit: Unable to access the X Display, is $DISPLAY set properly?

----------------------------------------------------------------------

http://testing.open-bio.org:8010/builders/Linux%2064%20-%20Python%202.6/builds/534/steps/shell/logs/stdio
http://testing.open-bio.org:8010/builders/Linux%2064%20-%20Python%202.6/builds/535/steps/shell/logs/stdio

Interestingly the same machine is passing the tests under other Python versions.
That would seem to rule out the $DISPLAY environment variable being the cause.
My hunch would be this is something about the Python 2.6 install, perhaps it
is missing some library (wxPython maybe).

Logged in as the buildslave on this machine I can see that both Python 2.6 & 2.7
have the same version of matplotlib installed, but only one is failing the test:

$ python2.5
Python 2.5.5 (r255:77872, Jan 14 2011, 17:09:55)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib

$ python2.6
Python 2.6.6 (r266:84292, Aug 31 2010, 16:21:14)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.0.0'

$ python2.7
Python 2.7 (r27:82500, Jul 13 2010, 14:02:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.0.0'


Peter


More information about the Biopython-dev mailing list