The installation of PLearn consist of three phases: installing the dependensys of PLearn, configuring the environnement and we finish with the compilation of PLearn. The compilation is done with pymake witch use python. To have more information on pymake do: pymake help
.
The next subsection discuss some other information about pymake that is cross-platform. After that their is sections that discuss the installation on linux, on Mac OS X and on windows with cygwin.
pymake help
To clean all the file generated during the compilation do pymake -clean [dir]
. The dir parameter is optinal and if it is not there, the current directory will be used.
(Not sure this is cross-platform, tested on linux)
If PLearn is on NFS(or other non local directory), you can speed up the
recompilation+liniking, with the -tmp
or the
-local_ofiles
options. Both will put the objects files in the
local directory /tmp/.pymake
instead of in the
PLearn directory. This can considerably speed up the linking phase.
The -tmp
options will compile all the objects files only with the local host.
When it is executed for the first
time on a computer, it will compile all files. The next time, it will not recompile the
previously compiled files if not needed. This is usefull is you have
limited space on the PLearn directory on NFS, as there won't be
any objects
file in it, but if you move to another local computer, you must recompile
everything.
The -local_ofiles
option will distribute the compilation on many computer(see
next paragraphe). When executed the first time, it will copy the
objects files from the PLearn directory to the /tmp/.pymake
directory. Then it will recompiles modified files and then link
them in this directory. Finaly it will
copy them in the PLearn directory. This way, if you change of
computer, you won't need to recompile everything, but it will need
more space in the PLearn directory.
So the only advantage of -tmp
over -local_ofiles
is that it take less
space in the directory of PLearn, but both will link at the same speed.
pymake
support the compilation on multiple computer for faster
compilation. The list of host is in a file in the directory /.pymake/. To know the name of the file run the compile command wanted. It will give you a line that look like this: (create a linux-i386.hosts file in your .pymake directory to list hosts for parallel compilation.)
In this exemple, the file is linux-i386.hosts
.
On this file, you must put one host by line and those hosts most be of the same architecture that the one who start the compilation. If you want the computer that start the compilation to participate in the compiling, it must be included in the file.
The default compilation mode is in debug mode (-dbg). To use other mode, add it as a paramater to the compilation line like this: pymake -opt plearn_curses.cc
.
Here is the list of compilation mode:
We suppose you have all the necessary software requirements in place (especially python).
For ex. under ubuntu, you can check the following packages install (using synaptic for ex.):
Required:
g++, python2.4, python, libnspr4, libnspr-dev, libboost-dev,
libboost-regex1.33.1, libboost-regex-dev, libboost-graph1.33.1, libboost-graph-dev
Strongly suggested: libncurses5, libncurses5-dev
and some version of lapack and blas. Ex:
refblas3, lapack3, lapack3-dev
Recommended (python and graphics related):
ipython, python-matplotlib,
python-numarray, python-numpy, mayavi, python2.4-dev,
python-tk, python-gtk2, python-gtkhtml2
You can use the following command under an Ubuntu (probably other derivative of Debian) to install the required packages: sudo apt-get install g++ python2.4 python libnspr4 libnspr-dev libboost-dev libboost-regex1.33.1 libboost-regex-dev libboost-graph1.33.1 libboost-graph-dev
.
The following command for the strongly suggested packages: sudo apt-get install libncurses5 libncurses5-dev refblas3 lapack3 lapack3-dev
.
And the following command for the recommanded packages:sudo apt-get install ipython python-matplotlib python-numarray python-numpy mayavi python2.4-dev python-tk python-gtk2 python-gtkhtml2
. The package that are alreay installed won't be reinstalled.
Then edit your .cshrc or .bashrc and
setenv PLEARNDIR ${HOME}/PLearn
export PLEARNDIR=${HOME}/PLearn
$PLEARNDIR/scripts
and $PLEARNDIR/commands
to your path.
$PLEARNDIR/python_modules
to your PYTHONPATH
setenv PYTHONPATH $PLEARNDIR/python_modules
export PYTHONPATH=$PLEARNDIR/python_modules
From within your PLearn directory run ./setup. This should create a .plearn sub-directory in your home directory, that will contain some configuration files.
Now you should be able to try and compile a first version of plearn. We have our own make system based on a python script (pymake) that automatically parses source files for dependencies and determines what to compile, and what to link (including optional libraries), and is able to run parallel compilation on several machines. It is easily customizable.
The compiling commands for the version with the minimum number of dependencies are:
cd PLearn/commands/ pymake -noblas plearn_noblas.cc
If it doesn't work, you may have to adapt the configuration file to your system (PLearn/.pymake/config)
If it does work, you can try with more dependencies to have more fonctionality with the commands pymake plearn_lapack.cc
, pymake plearn\_curses.cc
or even pymake plearn_python.cc
The easiest way to install external dependencies is through fink. You should install fink ( http://fink.sourceforge.net ) And its GUI Fink Commander ( http://finkcommander.sourceforge.net/ ). To gain access to the most up-to-date packages, enable the use of unstable package (e.g. in Menu Fink Commander / Preferences.../ Fink ). To be able to compile and link the core of plearn, you should install the following packages through fink:
Optional libraries also easily installable from fink:
You should then install fink ( http://fink.sourceforge.net ) And its GUI Fink Commander ( http://finkcommander.sourceforge.net/ ). We recommend you also enable the use of unstable package (in Menu Fink Commander / Preferences.../ Fink ) to gain access to the latest packages.
To be able to compile and link the core of plearn, you should install the following packages through fink:
Optional libraries also easily installable from fink:
You should make sure the following variables and paths are correctly defined in your
environment variables (in your .profile with your .bashrc
simply doing a source $HOME/.profile
)
# The default fink installs its packages in /sw and should already have # added the following line. source /sw/bin/init.sh # adapt to your configuration if your PLearn directory is not $HOME/PLearn export PLEARNDIR=$HOME/PLearn export PATH=/sw/bin:/sw/sbin:$PLEARNDIR/scripts:$PLEARNDIR/commands:.:$PATH export LD_LIBRARY_PATH="/sw/lib:/sw/lib/mozilla:$LD_LIBRARY_PATH" export LIBRARY_PATH=$LD_LIBRARY_PATH export CPATH="/sw/include:/sw/include/mozilla:$CPATH" export PYTHONPATH="$PLEARNDIR/python_modules:$PLEARNDIR/scripts:$PYTHONPATH" export SKELETONS_PATH=$PLEARNDIR/scripts/Skeletons
Restart a new shell for these to take effect. Make sure they're well defined in the new shell.
From within your PLearn directory run ./setup. This should create a .plearn sub-directory in your home directory, that will contain some configuration files. The compiling commands for the version with the minimum number of dependencies are:
cd PLearn/commands/ pymake -noblas plearn_noblas.cc
If it doesn't work, you may have to adapt the configuration file to your system (PLearn/.pymake/config)
You can try with more dependencies to have more fonctionality with the commands pymake plearn_lapack.cc
, pymake plearn_curses.cc
or even pymake plearn_python.cc
or pymake plearn_full.cc
To compile the plearn python extension module, do make_plearn_python_ext
This section describes a step-by-step installation under the Microsoft Windows environment. Note that the following instructions are outdated.
Cygwin (http://cygwin.com) is a Linux-like environment for Windows, and is currently the easiest route to using PLearn under Windows.
autoconf
(2.59-2)
gcc-g++
(3.4.4-1)
gcc-g77
(3.4.4-1)
lapack
(3.0-3)
libncurses-devel
(5.4-4)
make
(3.80-1)
python
(2.4.1-1)
subversion
(1.2.3-1)
Optional (but recommended) packages to install:
gdb
(20041228-3)
tcsh
(6.14.00-5)
unzip
(5.50-5)
vim
(6.4-2)
The default shell installed with Cygwin is bash, but in the following, we will
be using tcsh (though you may of course adapt the instructions below to get PLearn to
work with bash). Assuming you have installed the tcsh package and Cygwin is
installed in C:\cygwin
, edit C:\cygwin\cygwin.bat
and replace
the line bash --login -i
with tcsh -l
.
You may also change the default location of your home directory by adding the
following line at the beginning of the file (make sure you do not have blanks
in the path you provide):
@SET HOME=C:\MyCygwinHome
Note that it is suggested to use a “low-level” path for your home directory, i.e. as close to the root as possible, because of the limitations of Windows concerning the length of paths (which may cause some tests to fail in the test-suite).
tar.gz
files:
you will need the source for both Boost and Boost-Jam (the Boost installer).
Move these files to your Cygwin home directory.
The files used when writing this guide were boost_1_33_1.tar.gz
and boost-jam-3.1.11.tgz
.
You may now run Cygwin and launch the Boost installation:
tar zxvf boost_1_33_1.tar.gz
tar zxvf boost-jam-3.1.11.tgz
cd boost-jam-3.1.11
sh ./build.sh
cd ../boost_1_33_1
../boost-jam-3.1.11/bin.cygwinx86/bjam.exe -sTOOLS=gcc
--prefix=$HOME/local -sPYTHON_ROOT=/usr
-sPYTHON_VERSION=2.4 --builddir=/tmp/boost_build install
The installation command above will install Boost in the local
directory
under your home directory: you may remove the --prefix
option to perform
a system-wide installation (however, installing under your home directory is often
necessary for Linux users without administrator rights).
Do not worry about some of the Boost libraries not compiling, PLearn does not
need all of them.
Let us just create the appropriate links for those needed by PLearn:
cd ~/local/lib
ln -s libboost_regex-gcc-mt-1_33_1.dll libboost_regex.dll
ln -s libboost_python-gcc-mt-1_33_1.dll libboost_python.dll
cd ~/local/include
ln -s boost-1_33_1/boost
Download NumArray from
http://www.stsci.edu/resources/software_hardware/numarray
then install it with the following commands:
tar zxvf numarray-1.5.0.tar.gz cd numarray-1.5.0 python setup.py config install --gencode --prefix=$HOME/local
Note that (at least in version 1.5.0) there is a typo in a NumArray C++ file.
After you have installed NumArray with the commands above, edit
~/local/include/python2.4/numarray/arraybase.h
to manually remove the comma
at the end of line 117. Additionally, if you want to get rid of a gcc warning
when compiling PLearn, you can edit libnumarray.h
in the same directory and replace line 51 with
static void **libnumarray_API __attribute__ ((unused)) ;
Go to ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases
to get
the NSPR release for your operating system (in this guide we used the
4.6 release for Windows NT 5.0, in optimized mode).
Extract the zip file to a temporary directory, then move the content of the
include
directory (including its sub-directories) to ~/local/include/mozilla/nspr
(that you
will need to create), and the
libnspr4.dll
file (in the lib
directory) to ~/local/lib
.
Check the permissions for libnspr4.dll
: you need the “execute” permission
for PLearn to be able to run. You can set it with:
chmod u+x ~/local/lib/libnspr4.dll
First, go to the directory
where you wish to install PLearn (in this guide we will assume this is your
home directory), and check out the latest
version from the Subversion repository:
svn checkout svn://svn.berlios.de/plearn/trunk PLearn
Since pymake
will create directories named OBJS
to store
compiled object files, Subversion should ignore them: edit
your ~/.subversion/config
and, in the miscellany
section,
write the line
global-ignores = OBJS
Now, edit your ~/.cshrc
and add the following lines:
# Environment variables. setenv PLEARNDIR ${HOME}/PLearn setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/lib/lapack: ${PLEARNDIR}/commands:${PLEARNDIR}/scripts: ${HOME}/local/lib setenv PYTHONPATH ${PLEARNDIR}/python_modules: ${HOME}/local/lib/python2.4/site-packages setenv CPATH ${HOME}/local/include setenv LD_LIBRARY_PATH ${HOME}/local/lib setenv LIBRARY_PATH ${LD_LIBRARY_PATH} # Nicer prompt. set prompt = "%B%m %~%b > "
You need to redefine the PATH
environment variable because the
original one will usually contain directories with blanks (such as
Program Files
), which Cygwin has trouble with.
The last line is very optional (it just gives you a nicer prompt).
Now edit $PLEARNDIR/pymake.config.model
and look for the
python
optional library.
Just before, add the following lines:
python_version = '2.4' compileflags += ' -DPL_PYTHON_VERSION=240' python_lib_root = '/usr/lib' numpy_site_packages = join(homedir, 'local/lib/python2.4/site-packages/numarray')
Do a source ~/.cshrc
to reload your configuration file, then go
to your PLearn installation directory ($PLEARNDIR
) and run ./setup
. PLearn can now be compiled
with pymake $PLEARNDIR/commands/plearn
.