Problems using with pylab on Solaris

I a having trouble getting pylab working on Solaris. I can get it to install *I think* (though who knows how right it really is) but trying to use it just gives me an error. I admit that I know almost nothing about python and I know less about Solaris than GNU/Linux... I'm just tasked with installing. If anyone can point me in a direction, that would be great.

bash-3.00# uname -a
SunOS prague 5.10 Generic_127111-11 sun4u sparc SUNW,Sun-Blade-1500

bash-3.00# ipython
WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline library
Python 2.5.1 (r251:54863, Aug 23 2007, 14:50:40) [C]
Type "copyright", "credits" or "license" for more information.

IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import numpy

In [2]: print numpy.__version__
1.2.1

In [3]: import pylab

···

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)

/usr/local/versions/<ipython console> in <module>()

/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/pylab.py in <module>()
----> 1 from matplotlib.pylab import *
        2 import matplotlib.pylab
        3 __doc__ = matplotlib.pylab.__doc__

/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/pylab.py in <module>()
      204 from numpy import ma
      205
--> 206 from matplotlib import mpl # pulls in most modules
      207
      208 from matplotlib.dates import date2num, num2date,\

/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/mpl.py in <module>()
        2 from matplotlib import axis
        3 from matplotlib import axes
        4 from matplotlib import cbook
        5 from matplotlib import collections
        6 from matplotlib import colors

/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/artist.py in <module>()
        3 import matplotlib
        4 import matplotlib.cbook as cbook
----> 5 from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
        6 from path import Path
        7

/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/transforms.py in <module>()
       32 import numpy as np
       33 from numpy import ma
---> 34 from matplotlib._path import affine_transform
       35 from numpy.linalg import inv
       36

ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/_path.so: symbol __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref_: referenced symbol not found

+----------------------------------+

Gregory S. Morin |
Graduate Assistant |
RIT CS Dept. |
                                 >
"Quis custodiet ipsos custodes?" |

+----------------------------------+

Hard to say for sure, but this looks like a C++ name mangling error.
These occur when you compile with one compiler or version (eg g++) and
try to link with a lib compiled with another C++ compiler (eg the
solaris compiler). In this case, since the name mangling looks like
the stl string container, my guess is you are picking up the solaris
c++ stdlib and compiling with g++.

JDH

···

On Fri, Jan 9, 2009 at 1:13 PM, Gregory S Morin <gsm5953@...2443...> wrote:

ImportError: ld.so.1: python: fatal: relocation error: file
/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/_path.so:
symbol
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref_:
referenced symbol not found

Anyone who got this to build on Solaris have any info on which compiler/libraries you used, env vars, etc?

I've been trying a few different configs, but haven't made any real progress. I'll have to poke at it when I get some more free time, but I'm hoping maybe someone else has run into this.

Thanks John, for the comment, it is a good start.

···

+----------------------------------+

Gregory S. Morin |
Graduate Assistant |
RIT CS Dept. |
                                 >
"Quis custodiet ipsos custodes?" |

+----------------------------------+

On Fri, 9 Jan 2009, John Hunter wrote:

On Fri, Jan 9, 2009 at 1:13 PM, Gregory S Morin <gsm5953@...2443...> wrote:

ImportError: ld.so.1: python: fatal: relocation error: file
/usr/local/versions/python-2.5.1/lib/python2.5/site-packages/matplotlib/_path.so:
symbol
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref_:
referenced symbol not found

Hard to say for sure, but this looks like a C++ name mangling error.
These occur when you compile with one compiler or version (eg g++) and
try to link with a lib compiled with another C++ compiler (eg the
solaris compiler). In this case, since the name mangling looks like
the stl string container, my guess is you are picking up the solaris
c++ stdlib and compiling with g++.

JDH

I'll attach the Makefile I use on our solaris x86 system -- your
milage may vary!. The makefile is for upping, building, and
installing ipython, numpy, mpl and scipy from svn/bzr head:

HOME = /home/titan/johnh
SRCDIR = ${HOME}/python/svn
PREFIX=${HOME}/dev
INSTALL=/opt/basedir/research/site-packages
SVN = /opt/app/bin/svn
BZR = /opt/app/bin/bzr
CC=/opt/app/g++lib6/gcc-3.4/bin/gcc
CXX=/opt/app/g++lib6/gcc-3.4/bin/g++
PKG_CONFIG_PATH=/opt/app/gnome-2.6/lib/pkgconfig
INSTALL_LOCAL=${PREFIX}/lib/python2.4/site-packages

INSTALL_LOCAL=${PREFIX}/lib/python2.4/site-packages

clean_ipython:
  rm -rf ${SRCDIR}/ipython/build; true

clean_numpy:
  rm -rf ${SRCDIR}/numpy/build; true

clean_scipy:
  rm -rf ${SRCDIR}/scipy/build; true

clean_mpl:
  rm -rf ${SRCDIR}/mpl/build; true

clean: clean_ipython clean_numpy clean_scipy clean_mpl

up_ipython:
  ${BZR} merge --pull --directory=${SRCDIR}/ipython

up_mpl:
  ${SVN} up ${SRCDIR}/mpl

up_numpy:
  ${SVN} up ${SRCDIR}/numpy

up_scipy:
  ${SVN} up ${SRCDIR}/scipy

up: up_ipython up_numpy up_scipy up_mpl

local_ipython:
  cd ${SRCDIR}/ipython; python setup.py build
  rm -rf ${INSTALL_LOCAL}/ipython; true
  cd ${SRCDIR}/ipython; python setup.py install --prefix=${PREFIX}

local_numpy:
  cd ${SRCDIR}/numpy; CC=${CC} CXX=${CXX} python setup.py build
  rm -rf ${INSTALL_LOCAL}/numpy; true
  cd ${SRCDIR}/numpy; python setup.py install --prefix=${PREFIX}

local_scipy:
  cd ${SRCDIR}/scipy; CC=${CC} CXX=${CXX}
ATLAS=/opt/app/nonc++/atlas-3.7/lib PYTHONPATH=${INSTALL_LOCAL} python
setup.py build
  rm -rf ${INSTALL_LOCAL}/scipy; true
  cd ${SRCDIR}/scipy; CC=${CC} CXX=${CXX} PYTHONPATH=${INSTALL_LOCAL}
python setup.py install --prefix=${PREFIX}

local_mpl:
  cd ${SRCDIR}/mpl; CC=${CC} CXX=${CXX}
PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
PYTHONPATH=${INSTALL_LOCAL}:/opt/app/g++lib6/python-2.4/lib/python2.4/site-packages/3rdParty/gtk-2.6
python setup.py build_ext -I
/opt/app/gnome-2.6/include:/opt/app/libpng/include:/opt/app/freetype-2.1.10/include:/opt/app/freetype-2.1.10/include/freetype2
    -L /opt/app/gnome-2.6/lib:/opt/app/libpng/lib:/opt/app/freetype-2.1.10/lib
    -R /opt/app/gnome-2.6/lib:/opt/app/freetype-2.1.10/lib:/opt/app/libpng/lib
build
  rm -rf ${INSTALL_LOCAL}/matplotlib; true
  cd ${SRCDIR}/mpl; PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
PYTHONPATH=${INSTALL_LOCAL} python setup.py install --prefix=${PREFIX}

local: local_ipython local_numpy local_scipy local_mpl

all: clean up local

install:
  cp -r ${INSTALL} ${INSTALL}.bak
  rm -rf ${INSTALL}/IPython; true
  cd ${INSTALL_LOCAL}; cp -r IPython ${INSTALL}/
  rm -rf ${INSTALL}/numpy; true
  cd ${INSTALL_LOCAL}; cp -r numpy ${INSTALL}/
  rm -rf ${INSTALL}/scipy; true;
  cd ${INSTALL_LOCAL}; cp -r scipy ${INSTALL}/
  rm -rf ${INSTALL}/matplotlib ${INSTALL}/pylab* ${INSTALL}/dateutil
${INSTALL}/pytz; true
  cd ${INSTALL_LOCAL}; cp -r matplotlib pylab* dateutil pytz ${INSTALL}/

···

On Mon, Jan 12, 2009 at 2:51 PM, Gregory S Morin <gsm5953@...2443...> wrote:

Anyone who got this to build on Solaris have any info on which
compiler/libraries you used, env vars, etc?

I've been trying a few different configs, but haven't made any real
progress. I'll have to poke at it when I get some more free time, but I'm
hoping maybe someone else has run into this.

Thanks John, for the comment, it is a good start.