By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,096 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,096 IT Pros & Developers. It's quick & easy.

Req: Python 2.x incompatibility with MatPlotlab & SciTools

P: 17
Hi folks

I am teaching myself Python by working through Hans Petter Langtangen's excellent book "Primer on Scientific Programming in Python".

The exercises in chapter 4 of the book require the student to use Python with the freely downloadable tools MatplotLib and SciTools to plot graphs of mathematical functions.

Despite downloading and installing numerous different versions of Python 2.x, MatPlotLib and SciTools, I am unable to find a combination which will work together without crashing.

I'm currently using a Windows XP laptop with:
Python 2.6.6
IDLE 2.6.6
MatplotLib 0.99,3 win32 Py2.6
Scitools from scipy-0.80-win32-superpack-python 2.6

When I try to run a simple script to test the plotting functions, I get the error messages attached below.

I don't want to use Python 3, as there still seem to be some teething problems with this, and many of the modules that I've already written or need to use are not compatible with Python 3.x.

I've emailed the author, but have not yet had a reply.
I wondered if anyone else on the Bytes forum had encountered this problem and could tell me a compatible combination of versions of Python 2.x, MatPlotLib and Scitools; and the URL of sites where I can download these.

Many thanks in anticipation


Expand|Select|Wrap|Line Numbers
  1. from scitools.std import *
  3. def f(t):
  4.     return t**2*exp(-t**2)
  6. t = linspace(0,3,51)
  7. y = zeros(len(t))
  8. for i in xrange(len(t)):
  9.     y[i] = f(t[i])
  11. plot(t,y)

scitools.easyviz backend is matplotlib

Traceback (most recent call last):
File "C:\Python\Dave_Book Exercises\4_3_2 Plot", line 11, in <module>
File "C:\Python26\lib\site-packages\scitools\easyviz\", line 3060, in plot
File "C:\Python26\lib\site-packages\scitools\easyviz\", line 906, in _replot
File "C:\Python26\lib\site-packages\matplotlib\", line 352, in draw
File "C:\Python26\lib\site-packages\matplotlib\backends\", line 215, in draw
File "C:\Python26\lib\site-packages\matplotlib\backends\", line 314, in draw
File "C:\Python26\lib\site-packages\matplotlib\", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\", line 773, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\", line 1735, in draw
File "C:\Python26\lib\site-packages\matplotlib\", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\", line 742, in draw
File "C:\Python26\lib\site-packages\matplotlib\", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\", line 196, in draw
File "C:\Python26\lib\site-packages\matplotlib\", line 518, in draw
bbox, info = self._get_layout(renderer)
File "C:\Python26\lib\site-packages\matplotlib\", line 280, in _get_layout
clean_line, self._fontproperties, ismath=ismath)
File "C:\Python26\lib\site-packages\matplotlib\backends\", line 148, in get_text_width_height_descent
texmanager = self.get_texmanager()
File "C:\Python26\lib\site-packages\matplotlib\", line 374, in get_texmanager
from matplotlib.texmanager import TexManager
File "C:\Python26\lib\site-packages\matplotlib\", line 72, in <module>
class TexManager:
File "C:\Python26\lib\site-packages\matplotlib\", line 94, in TexManager
_dvipng_hack_alpha = dvipng_hack_alpha()
File "C:\Python26\lib\site-packages\matplotlib\", line 68, in dvipng_hack_alpha
raise RuntimeError('Could not obtain dvipng version')
RuntimeError: Could not obtain dvipng version
Jan 12 '11 #1
Share this Question
Share on Google+
1 Reply

P: 1
I agree with Dave067 that Langtangen's "A Primer on Scientific Programming with Python" is an excellent textbook. I have had good luck in running his example programs. Like Dave067 I use Python 2.6.6 and IDLE 2.6.6. I use an HP desktop computer with Vista Home Premium Edition.

The installation file that I used for matplotlib is
available on the web at

The installation file that I used for SciTools is
available on the web at

A Google search on the names of these installation files shows many other URLs where they can be downloaded.

Hope this helps.
May 1 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.