As I Doothings

Navigation

Recent site activity

installing Biggles and NumPy

EI want Biggles for nice plots.

Biggles requires NumPy
So I went ahead to get NumPy, but...

NumPy requires Python 2.4.x .
I had 2.3 so I just got python 3.1. The Mac OS X dmg installs python at

/Library/Frameworks/Python.framework/Versions/3.1/bin/python3 , so after I manually changed my /usr/bin/python link to point to python3.1 , I was fine.

NumPy also requires zlib support. python interactive help says it is here:

    /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/zlib.so

NumPy also needs Distutils

Again, I have it here, according to the python interactive help:

/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/distutils/__init__.py

But NumPy installation shows me this :

$ sudo python setup.py install
Password:
  File "setup.py", line 62
    print " --- Could not run svn info --- "
                                           ^
SyntaxError: invalid syntax

I have everything I need I believe. Actually what the? print gives me trouble in general :
>>> print "yes"
  File "<stdin>", line 1
    print "yes"
              ^
SyntaxError: invalid syntax
>>>
>>> print ("hello")
hello
>>>

How could they get that wrong? Hmm. Once I fixed this in setup.py , I got another error
$ sudo python setup.py install
Password:
Traceback (most recent call last):
  File "setup.py", line 18, in <module>
    import __builtin__
ImportError: No module named __builtin__
$

I'm doing something wrong here. What? Could it be that NumPy doesn't work with python 3.x , only python 2.4.x ?

Okay here we go again, so now I got Python 2.6

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/zlib.so
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/__init__.py

Let's try to install NumPy again:

Well, this time
$ sudo python setup.py install
took me much further. Evertying started to compile.

I think it installed, but this was slightly disturbing , from within the Python interactive help :
help> numpy
problem in numpy - <type 'exceptions.ImportError'>: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python intepreter from there.

help> modules

Please wait a moment while I gather a list of all available modules...

Audio_mac           _functools          fnmatch             pyexpat
....
_Qt                 contextlib          numpy               tty
....

But it does look like it is 'there'.

Next, Biggles also needs GNU Plotutils

I went for the port collection. I hope that will be accessible by python. I know Mac OS X has this strange separation between applications installed by port and those installed by compiling them, but I will try this out anyway.

$ sudo port info plotutils
Password:
plotutils @2.5.1, Revision 1 (graphics)
Variants:    universal, x11

GNU plotting utilities package, including GNU libplot: a thread-safe function library for exporting two-dimensional vector graphics files, and
for displaying animated vector graphics under the X Window System.
Homepage:    http://www.gnu.org/software/plotutils/

Library Dependencies: libpng, zlib
Platforms:            darwin
Maintainers:          nomaintainer@macports.org
$ sudo port install plotutils
--->  Fetching plotutils
--->  Attempting to fetch plotutils-2.5.1.tar.gz from http://mirrors.ibiblio.org/pub/mirrors/gnu/ftp/gnu/plotutils
--->  Attempting to fetch plotutils-2.5.1.tar.gz from http://distfiles.macports.org/plotutils
--->  Verifying checksum(s) for plotutils
--->  Extracting plotutils
--->  Configuring plotutils
--->  Building plotutils
--->  Staging plotutils into destroot
--->  Installing plotutils @2.5.1_1
--->  Activating plotutils @2.5.1_1
--->  Cleaning plotutils


Biggles also instructs that plotutils' libraries need to be accessible in the following way :

    Available at <http://www.gnu.org/software/plotutils/>. After installing,
    you need to make sure biggles can find libplot.so. On most systems adding
    $(prefix)/lib to LD_LIBRARY_PATH will work, where $(prefix) is the
    directory plotutils was installed in (usually /usr/local).


[5] advises :

"port puts libraries in /opt/local/lib and header files in /opt/local/include" and continues to say 

ports creates .dylib files which are like shared libraries. You can link to them in a makefile just like you would to a static library, ending in .a
Here's a lttle note about mac os x shared library paths from the build instructions for xerces-c:
"On Linux and Solaris, the environment variable name is called LD_LIBRARY_PATH, on AIX it is LIBPATH, on Mac OS X it is DYLD_LIBRARY_PATH, while on HP-UX it is SHLIB_PATH."

So , hmm...
$ echo $DYLD_LIBRARY_PATH

$

Anyway I hope Biggles can recongize the plotutils libraries compiled created by Mac OS X
$ ls /opt/local/lib/libplot
libplot.2.2.3.dylib     libplot.a               libplot.la              libplotter.2.dylib      libplotter.dylib
libplot.2.dylib         libplot.dylib           libplotter.2.2.3.dylib  libplotter.a            libplotter.la

Let's give it a shot. If this doesn't work, I'm going to sleep.

$ sudo python setup.py build_ext -I/opt/local/include/
running build_ext
building '_biggles' extension
creating build
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/src
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I/opt/local/include/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/_biggles.c -o build/temp.macosx-10.3-fat-2.6/src/_biggles.o
creating build/lib.macosx-10.3-fat-2.6
creating build/lib.macosx-10.3-fat-2.6/biggles
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/src/_biggles.o -o build/lib.macosx-10.3-fat-2.6/biggles/_biggles.so
building 'libplot.libplot' extension
creating build/temp.macosx-10.3-fat-2.6/src/libplot
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I/opt/local/include/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/libplot/libplot.c -o build/temp.macosx-10.3-fat-2.6/src/libplot/libplot.o
src/libplot/libplot.c: In function 'new':
src/libplot/libplot.c:199: warning: passing argument 2 of 'PyDict_Next' from incompatible pointer type
src/libplot/libplot.c: In function 'new':
src/libplot/libplot.c:199: warning: passing argument 2 of 'PyDict_Next' from incompatible pointer type
creating build/lib.macosx-10.3-fat-2.6/biggles/libplot
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/src/libplot/libplot.o -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lplot -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -o build/lib.macosx-10.3-fat-2.6/biggles/libplot/libplot.so
/usr/bin/ld: warning -L: directory name (/usr/X11R6/lib64) does not exist
/usr/bin/ld: for architecture i386
/usr/bin/ld: can't locate file for: -lplot
collect2: ld returned 1 exit status
/usr/bin/ld: warning -L: directory name (/usr/X11R6/lib64) does not exist
/usr/bin/ld: for architecture ppc
/usr/bin/ld: can't locate file for: -lplot
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccz4MX26.out (No such file or directory)
error: command 'gcc' failed with exit status 1
$

Two things seemed to have gone wrong.
1) Biggles can't find the X11 libraries.

2) and it can't seem to fine the plotutils header files I put in front of its face !
/opt/local/include/plot.h

To address the above,
1) I have to see if I can make this setup script use the correct path for X11 libs , first off




References
[1] http://numpy.scipy.org/

[2] http://biggles.sourceforge.net/

[3] http://docs.python.org/3.1/install/index.html

[4] http://www.gnu.org/software/plotutils

[5] http://users.soe.ucsc.edu/~aneeman/mac_notes.html

[6] http://docs.python.org/3.0/using/mac.html