473,408 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Req: Python 2.x incompatibility with MatPlotlab & SciTools

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


Dave
(UK)

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

>>>
scitools.easyviz backend is matplotlib

Traceback (most recent call last):
File "C:\Python\Dave_Book Exercises\4_3_2 Plot test_DW.py", line 11, in <module>
plot(t,y)
File "C:\Python26\lib\site-packages\scitools\easyviz\common.py", line 3060, in plot
self._replot()
File "C:\Python26\lib\site-packages\scitools\easyviz\matplotlib_.py", line 906, in _replot
self._g.draw()
File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 352, in draw
get_current_fig_manager().canvas.draw()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 215, in draw
FigureCanvasAgg.draw(self)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 314, in draw
self.figure.draw(self.renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1735, in draw
a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 742, in draw
tick.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 196, in draw
self.label1.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 518, in draw
bbox, info = self._get_layout(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 280, in _get_layout
clean_line, self._fontproperties, ismath=ismath)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 148, in get_text_width_height_descent
texmanager = self.get_texmanager()
File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line 374, in get_texmanager
from matplotlib.texmanager import TexManager
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 72, in <module>
class TexManager:
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 94, in TexManager
_dvipng_hack_alpha = dvipng_hack_alpha()
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 68, in dvipng_hack_alpha
raise RuntimeError('Could not obtain dvipng version')
RuntimeError: Could not obtain dvipng version
>>>
Jan 12 '11 #1
1 2449
ethana
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
matplotlib-1.0.1.win32-py2.6.exe
available on the web at
http://www.lfd.uci.edu/~gohlke/pythonlibs/

The installation file that I used for SciTools is
SciTools-0.8.win32.exe
available on the web at
http://code.google.com/p/scitools/downloads/detail?n

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

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

Similar topics

0
by: Kandidates | last post by:
If you are interested in a position, please review the requirements and reply with your salary requirement. My clients main concern with these positions is Python. Elaborating on your knowledge...
0
by: Will | last post by:
Hi all, Please excuse the longish post. I'm new to Python (and programming), but love what I see and believe it to be an important language. I have (at least) one retail client (with single...
2
by: Xah Lee | last post by:
© # -*- coding: utf-8 -*- © # Python © © # in Python, one can define a boxed set © # of data and functions, which are © # traditionally known as "class". © © # in the following, we define a...
0
by: Fuzzyman | last post by:
It's finally happened, `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ is finally released. Versions for Python 2.3 & 2.4 are available from `The Movable Python Shop...
12
by: BartlebyScrivener | last post by:
Sorry, I have a knack for making things more difficult than they need to be. I'm on Windows XP and waiting for the ActiveState release of Python 2.5. I want to experiment with sqlite and I see that...
5
by: robert | last post by:
Turning algs for old NumPy modules into numpy code I suffer from this: Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy...
16
by: Amir Michail | last post by:
Hi, It seems to me that measuring productivity in a programming language must take into account available tools and libraries. Eclipse for example provides such an amazing IDE for java that it...
3
by: lee.walczak | last post by:
Hi, I have just started writing a GUI using wxpython after finding a limitation using Tkinter. I have read most tutorials on wxpython and slowly becoming accustomed considering I started with...
6
by: Dave067 | last post by:
Hi This is my first attempt at writing Python script - it's probably a bit ambitious, but there again, whatever doesn't kill you makes you stronger... ;-) I'm trying to write a script for a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.