Installing PyNGL/PyNIO under MacOSXIf you plan to build and/or install PyNIO or PyNGL on a MacOSX system, you should look over these notes.
If you are using the python that came already installed on your Mac, then it is likely a "universal binary". Some users have had trouble importing PyNGL and PyNIO using a universal binary.
A universal binary is one that was built to run under multiple architectures; PyNGL and PyNIO can only be built for one architecture, which can pose a problem.
If you are trying to load PyNGL or PyNIO, and getting the following error:
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/PyNGL/fplib.so, 2): no suitable image found. Did find: /usr/local/lib/python2.7/site-packages/PyNGL/fplib.so: mach-o, but wrong architecturethen this means you likely have a universal python binary. You can force python to run in in a particular architecture by typing (for 32-bit):
arch -arch i386 python ngl01p.pyor, for 64-bit:
arch -arch x86_64 python ngl01p.py
You can quickly test if you have a "universal" python binary using the following UNIX command:
file `which python`If you get multiple lines of output like this:
/usr/bin/python (for architecture x86_64):Mach-O 64-bit executable x86_64 /usr/bin/python (for architecture i386):Mach-O executable i386 /usr/bin/python (for architecture ppc7400):Mach-O executable ppcThen you have a python binary that is universal. If the output is just one line:
/usr/local/bin/python: Mach-O 64-bit executable x86_64then you do not have a universal binary.
Building Python and NumPy from scratchIf you are still having problems with using PyNGL or PyNGL with your universal python binary, then consider posting your problem to the pyngl-talk email list.
Otherwise, you can build your own versions of Python and NumPy for the same architecture that matches whatever PyNIO or PyNGL binary you have.
Building and installing Python
- Download Python version 2.7.x (not 3.x) or earlier, from:
The file to download will be called something like "Python 2.7.2 compressed source tarball (for Linux, Unix, or Mac OS X)".
- Uncompress and untar the file you just downloaded (somewhere where
you have at least 175 megabytes of disk space). We will use Python
2.7.2 as an example:
gunzip Python-2.7.2.tgz tar -xf Python-2.7.2.tar
- Set up your environment for building python.
To make sure Python is built for one architecture only, you will need
to set the CFLAGS and CXXFLAGS environment variables. In this example,
we are also setting CC and CXX to make sure it uses the gcc and g++
compilers for the build:
setenv CC gcc setenv CXX g++ setenv CFLAGS -m64 setenv CXXFLAGS -m64bash/sh:
export CC=gcc export CXX=g++ export CFLAGS=-m64 export CXXFLAGS=-m64
- Run the configure program.
This program allows you to specify where you want to install Python. We will use "/usr/local" as an example:
cd Python-2.7.2 ./configure --prefix=/usr/local
- Build and install Python.
If the "./configure" command looks like it was successful, then you can complete the build of Python by typing:
make all install
- Test that the build was successful.
You first have to make sure this new Python is on your search path:
which pythonIf you had just installed Python to /usr/local, then the above command should report:
/usr/local/bin/pythonIf it doesn't, then you need to check your build to make sure there were no problems. Also check that /usr/local/bin is on your search path, and that it's on your path before any other paths that might contain other versions of Python:
echo $PATHIf /usr/local/bin is not on your search path, or it's not in the right place, then remedy this.
Then, to check that the new Python was installed correctly, type:
python -VThis should report:
Building and installing NumPy
- Download NumPy from:
The file to download will be called something like "numpy-1.6.1.tar.gz".
- Once you have the file, you need to uncompress and untar it
(somewhere where you have about xxx megabytes of disk space):
gunzip numpy-1.6.1.tar.gz tar -xf numpy-1.6.1.tar
- Install NumPy, being sure to use the Python you just built.
cd numpy-1.6.1 python setup.py install
- Test that the NumPy build was successful.
python import numpy numpy.__version__This should report
Build PyNGL and/or PyNIO against this Python and NumPyYou can now use one of our precompiled PyNGL or PyNIO binaries with this version of Python and NumPy, or you can build these packages from source yourself.
Please see the appropriate instructions: