Compile and/or import problem

I'm having some problems compiling matplotlib 0.7.1 on solaris 8. I believe I have all the prerequisites there. If I try to compile with setup.py as it is originally, immediately it complains with "sh: pkg-config: not found", and finally dies after working a while. If I change "BUILD_GTKAGG = 0" it compiles with some complaints like

/usr/local/pkg/python/include/python2.3/pyconfig.h:856:1: warning: "_XOPEN_SOURCE" redefined
<command line>:1:1: warning: this is the location of the previous definition

But seems to work.

When I try to import it I get:

ghia{chodgins}120: python
Python 2.3 (#1, Sep 12 2003, 16:47:52)
[GCC 3.0.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/pkg/python/lib/python2.3/site-packages/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File "/usr/local/pkg/python/lib/python2.3/site-packages/matplotlib/pylab.py", line 191, in ?
    from backends import new_figure_manager, error_msg, \
  File "/usr/local/pkg/python/lib/python2.3/site-packages/matplotlib/backends/__init__.py", line 20, in ?
    globals(),locals(),[backend_name])
  File "/usr/local/pkg/python/lib/python2.3/site-packages/matplotlib/backends/backend_gtkagg.py", line 16, in ?
    from _gtkagg import agg_to_gtk_drawable
ImportError: No module named _gtkagg
>>>

I'm not sure how to proceed from here. I also am not a python programmer, just a system administrator trying to get this installed. Any help or fingers pointing me in a direction are greatly appreciated. Thanks.

Cindy

Cindy Hodgins Burian wrote:

If I change "BUILD_GTKAGG = 0" it compiles with some complaints like

This will keep it form building the GTKAGG back end...do you need that?

>>> import pylab

   from _gtkagg import agg_to_gtk_drawable

You're getting this error because you don't have the GTKAGG back end, which makes sense, as you told setup.py not to build it.

The problem is that your matplotlibrc file sets gtkagg as the default back end. First, try this:

>>> import matplotlib
>>> matplotlib.use('Agg')
>>> import pylab

If that works, then you seem to have a working matplotlib with the Agg back end. If you generating plots that you want to save as PNG and use ion a wed site or something, you're done. You should also be able to use it with wxPython. Tkinter may also work. If you do need the PyGTK back end, I can't help you, except to say that make sure you have PyGTK working first.

To change the default back end, edit matplotlibrc:

http://matplotlib.sf.net/.matplotlibrc

Good luck,

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...