Seabright Technology Header Image

Trouble with Python and matplotlib on Windows XP

Ran into an interesting problem with ActivePython 2.5.4 and the great matplotlib/pylab math and plotting library.  I was seeing Python lock up hard enough that it had to be killed via the task manager when running a fairly simple script – no error messages or anything.  I traced it down to a ‘import pylab’ statement.  Doing it manually brought up the following cryptic error message:

$ python
ActivePython 2.5.4.4 (ActiveState Software Inc.) based on
Python 2.5.4 (r254:67916, Apr 27 2009, 15:41:14) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
3 [main] python 768 c:\Others\Python25\python.exe: *** fatal error - Incompatible cygwin .dll
-- incompatible per_process info 0 != 168

There’s only one copy of cygwin1.dll on my machine so it must be something else.  It turns out that the Windows binary of the matplotlib tkagg backend is linked against tcl8.4.dll.  Later versions of ActivePython include tcl8.5 instead, leading tkagg to find the random copy of tcl8.4 that came with cygwin.

No idea on why cygwin is incompatible with itself, but the solution was to install ActiveTcl 8.4 and to put it in the cygwin path ahead of /usr/bin.  Cryptic.

Leave a Reply