Problems with Matplotlib and Python 2.6

Dear ALL,

Long time no see.... Well, I have recently upgraded from Ubuntu
Intrepid to Jaunty (sure, I know that I'm a couple of versions
delayed, but keeping a working system stable is essential). I did not
a fresh install of Ubuntu, just upgraded using the system's facility
for that. Previously I have did that from Ubuntu Hardy to Intrepid,
with less (or no) troubles. However, in Jaunty the default Python
interpreter has been upgraded from 2.5 to 2.6 and this is presenting
the most annoying problems.

For now, the most vexing problem is that although Matplotlib is
correctly installed and seemingly working, it does not show any
graphics! For exemple, if I run the simple example from Matplotlib's
website:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import randn, hist
x = randn(10000)
hist(x, 100)

Instead of a nice histogram, I am just presented with a "dump" of the
contents of an array:

(array([ 2, 0, 1, 2, 1, 2, 1, 3, 4, 7, 15, 16, 9,
      (cut here to save space)
       3.97823055, 4.05708515, 4.13593975, 4.21479434, 4.29364894,
        4.37250354]), <a list of 100 Patch objects>)

No error messages or complaints about a missing graphics backend is
issued, so I'm lost.

Any hints?

Thanks in advance for any assistance you can provide.

Best wishes,

···

--
Dr. Mauro J. Cavalcanti
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://sites.google.com/site/maurobio
Linux Registered User #473524 * Ubuntu User #22717

Dear ALL,

Long time no see.... Well, I have recently upgraded from Ubuntu
Intrepid to Jaunty (sure, I know that I'm a couple of versions
delayed, but keeping a working system stable is essential). I did not
a fresh install of Ubuntu, just upgraded using the system's facility
for that. Previously I have did that from Ubuntu Hardy to Intrepid,
with less (or no) troubles. However, in Jaunty the default Python
interpreter has been upgraded from 2.5 to 2.6 and this is presenting
the most annoying problems.

Yeah, let's all thanks Ubuntu for the its attention to quality and
well-prepared transitions...

For now, the most vexing problem is that although Matplotlib is
correctly installed and seemingly working, it does not show any
graphics! For exemple, if I run the simple example from Matplotlib's
website:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import randn, hist
x = randn(10000)
hist(x, 100)

On Debian,

$ python2.6
Python 2.6.5rc2 (r265rc2:78822, Mar 11 2010, 16:48:00)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import randn, hist, show
x = randn(10000)
hist(x, 100)
show()

works as expected

$ python2.6 -c "import matplotlib ; print matplotlib.__version__"
0.99.1.1

Wouldn't you want to run ipython instead of python?

Regards,

···

On Thu, Apr 1, 2010 at 13:53, Mauro Cavalcanti <maurobio@...287...> wrote:
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

When you run setup.py, the install routines attempt to determine what
backend to use. If a suitable gui toolkit is not found, mpl defaults
to the Agg backend. I suggest creating a matplotlibrc file that
specifies a gui backend.

Darren

···

On Thu, Apr 1, 2010 at 7:53 AM, Mauro Cavalcanti <maurobio@...287...> wrote:

Dear ALL,

Long time no see.... Well, I have recently upgraded from Ubuntu
Intrepid to Jaunty (sure, I know that I'm a couple of versions
delayed, but keeping a working system stable is essential). I did not
a fresh install of Ubuntu, just upgraded using the system's facility
for that. Previously I have did that from Ubuntu Hardy to Intrepid,
with less (or no) troubles. However, in Jaunty the default Python
interpreter has been upgraded from 2.5 to 2.6 and this is presenting
the most annoying problems.

For now, the most vexing problem is that although Matplotlib is
correctly installed and seemingly working, it does not show any
graphics! For exemple, if I run the simple example from Matplotlib's
website:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import randn, hist
x = randn(10000)
hist(x, 100)

Instead of a nice histogram, I am just presented with a "dump" of the
contents of an array:

(array([ 2, 0, 1, 2, 1, 2, 1, 3, 4, 7, 15, 16, 9,
(cut here to save space)
3.97823055, 4.05708515, 4.13593975, 4.21479434, 4.29364894,
4.37250354]), <a list of 100 Patch objects>)

No error messages or complaints about a missing graphics backend is
issued, so I'm lost.

Any hints?

Dears Sandro & Darren,

First of all, thank you *very much* for the fast reply!

Let's see... I have the same problem (no graphics display) with either
Python and IPython. BTW, in previous versions of Python which I'v used
(2.3, 2.4, and 2.5) Matplotlib graphic backends always worked quite
well.

I forgot to mention that I'm using the default version of Matplotlib
that comes with Jaunty and it is quite old (0.98.5.2). Should I will
try to reinstall it from the sources (easy_install only finds the old
version)?

I will check the matplotlibrc, but why should the Agg default backend not work?

With best regards,

2010/4/1 Darren Dale <dsdale24@...287...>:

···

On Thu, Apr 1, 2010 at 7:53 AM, Mauro Cavalcanti <maurobio@...287...> wrote:

Dear ALL,

Long time no see.... Well, I have recently upgraded from Ubuntu
Intrepid to Jaunty (sure, I know that I'm a couple of versions
delayed, but keeping a working system stable is essential). I did not
a fresh install of Ubuntu, just upgraded using the system's facility
for that. Previously I have did that from Ubuntu Hardy to Intrepid,
with less (or no) troubles. However, in Jaunty the default Python
interpreter has been upgraded from 2.5 to 2.6 and this is presenting
the most annoying problems.

For now, the most vexing problem is that although Matplotlib is
correctly installed and seemingly working, it does not show any
graphics! For exemple, if I run the simple example from Matplotlib's
website:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import randn, hist
x = randn(10000)
hist(x, 100)

Instead of a nice histogram, I am just presented with a "dump" of the
contents of an array:

(array([ 2, 0, 1, 2, 1, 2, 1, 3, 4, 7, 15, 16, 9,
(cut here to save space)
3.97823055, 4.05708515, 4.13593975, 4.21479434, 4.29364894,
4.37250354]), <a list of 100 Patch objects>)

No error messages or complaints about a missing graphics backend is
issued, so I'm lost.

Any hints?

When you run setup.py, the install routines attempt to determine what
backend to use. If a suitable gui toolkit is not found, mpl defaults
to the Agg backend. I suggest creating a matplotlibrc file that
specifies a gui backend.

Darren

--
Dr. Mauro J. Cavalcanti
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://sites.google.com/site/maurobio
Linux Registered User #473524 * Ubuntu User #22717

I will check the matplotlibrc, but why should the Agg default backend not work?

Because 'Agg' is a "file-based" backend, that you use when you want to
generate a file as output (a PNG, f.e.), so savefig() works while
show() not.

You are looking for a GUI backend, something like TkAgg, GTKAgg or
Qt4Agg, that calling show() will generate a window with the graph in
it.

Regards,

···

--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

Are you even expecting the correct behaviour? I'm under the impression
that it's necessary to import and call show() if you want to see the
plot? I thought it was necessary to use IPython in pylab mode to get
the behaviour you're after i.e calling hist also brings up the plot
window.

I guess I'm hijacking your thread to ask whether the example on the
front page is misleading, or if my understanding is flawed?

Cheers,
Scott

···

On 1 April 2010 13:53, Mauro Cavalcanti <maurobio@...287...> wrote:
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pylab import randn, hist
x = randn(10000)
hist(x, 100)

Instead of a nice histogram, I am just presented with a "dump" of the
contents of an array:

(array([ 2, 0, 1, 2, 1, 2, 1, 3, 4, 7, 15, 16, 9,
(cut here to save space)
3.97823055, 4.05708515, 4.13593975, 4.21479434, 4.29364894,
4.37250354]), <a list of 100 Patch objects>)

No error messages or complaints about a missing graphics backend is
issued, so I'm lost.