sip module error

I am trying to run a basic code and keep getting the following error:

from pylab import*

File "C:\Python27\lib\site-packages\", line 1 from matplotlib.pylab import *

File "C:\Python27\lib\site-packages\matplotlib\", line 264 from matplotlib.pyplot import *

File "C:\Python27\lib\site-packages\matplotlib\", line 95 new_figure_manager, draw_if_interactive, _show = pylab_setup()

File "C:\Python27\lib\site-packages\matplotlib\", line 25, in pylab_setup globals(),locals(),[backend_name])

File "C:\Python27\lib\site-packages\matplotlib\backends\", line 12 from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\

File "C:\Python27\lib\site-packages\matplotlib\backends\", line 23 from qt4_compat import QtCore, QtGui, _getSaveFileName, version

File "C:\Python27\lib\site-packages\matplotlib\backends\", line 36 import sip

ImportError: No module named sip

What is the reason for the sip mudule being imported and how do I fix the error? Thanks

I think the problem is that pylab is a GUI interface to matplotlib; PythonAnywhere, because it's a web-based platform, doesn't have any GUI support (we're looking into ways to change that, but haven't had much luck so far). There are some hints on using matplotlib without a GUI here, hopefully you'll find them useful.

@la: Welcome to PA. I hope you like it enough to phone home about...☺

@a2j wasn't that et?

@giles: Sounds entirely plausible, but oddly I don't get that error when running from matplotlib.pylab import * from a standard Python shell on PA.

@la: I've certainly used matplotlib in the past to generate server-side PNG files, although as I wrote the code in my previous job I couldn't give you any examples I'm afraid. However, I don't remember ever using the pylab module - I think I just pulled in some modules from matplotlib directly, which seems to bear out the tutorial that giles links above. The FigureCanvasAgg class definitely rings a bell.

As an aside, I do remember it can be tricky to generate graphs on-the-fly in response to web requests - most of the matplotlib stuff seems intent on writing to files. I believe the only way I figured out how to do it was to construct a cStringIO object, pass that in to accept the data and then read it back out as the response to the GET request.

However, if you're doing that sort of on-the-fly graphing and your requirements are relatively simple then you might find something like the Google Chart Tools API is less effort.

@giles: Funny, E.T. is on my TV right now as I write this! I was also saying it in reference to SIP being used for making calls.

@Cartroo, @la -- you're right, I can't repro it now either. Both from matplotlib.pylab import * and from pylab import * work for me in fresh Python 2.7 consoles. @la -- do you have some code that you could share that shows the problem?

@a2j -- aha! Now I understand...

@giles: Sorry about that...I do seem to find myself out a bit too far on the humor limb from time to time.

The view is nice, but it can get a bit lonely.

@a2j: If you're lonely, perhaps Sid can comfort you.

(Ah, brings back memories of implementing VOIP stacks in the crazy days when I worked for beer and didn't bother looking at the pension plan).

@Cartroo: uh, thanks...I think...☺

Matplotlib GUI support would be awesome. I just want to use the ginput() function.