Tuesday, September 21, 2010

Install confusion

Trying to install PyNCL on a Red Hat machine without sudo priv's.

1) Py2.7 from source. Builds fine. Runs fine.

2) numpy from source using aforesaid python. atlas/blas instructions aren't too clear, proceed blindly ahead. build works fine.

3) import numpy or import numarray fails:

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.

very little info on Google about this. Try various versions of current working directory. Failure all the same.

4) looks like this code:


if __NUMPY_SETUP__:
import sys as _sys
print >> _sys.stderr, 'Running from numpy source directory.'
del _sys
else:
try:
from numpy.__config__ import show as show_config
except ImportError, e:
msg = """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."""
raise ImportError(msg)
from version import version as __version__


is getting invoked. Try setup command, but it tries to install in /usr/local/lib/python2.7

5) How to tell setup where to put the numpy?

setup.py install --help

helps, yielding


Options for 'install' command:
--prefix installation prefix
--exec-prefix (Unix only) prefix for platform-specific files
--home (Unix only) home directory to install under
--install-base base installation directory (instead of --prefix or --
home)
--install-platbase base installation directory for platform-specific files
(instead of --exec-prefix or --home)
--root install everything relative to this alternate root
directory
--install-purelib installation directory for pure Python module
distributions
--install-platlib installation directory for non-pure module distributions
--install-lib installation directory for all module distributions
(overrides --install-purelib and --install-platlib)
--install-headers installation directory for C/C++ headers
--install-scripts installation directory for Python scripts
--install-data installation directory for data files


It must be one of those!

6) Used "--prefix". setup.py runs without complaint.

Haha! New error. "{PATH}/multiarray.so: cannot open shared object file: No such file"

but the file exists! Now what?

7) Wait - no. I used the system python not the self-installed 2.7. It works! numpy is imported.

8) Now get PyNCL? (ncl is already working on this machine)

NO! Looks like I have to do the numpy thing again, because PyNGL recommends against the g77 compiler and requires gfortran. So my numpy, though working, is wrong.

9) While I'm at it, no BLAS/ATLAS? etc?

No comments: