views:

559

answers:

7

I have access to a cluster of Unix machines, but they don't have the software I need (numpy, scipy, matplotlib, etc), so I have to install them by myself (I don't have root permissions, either, so commands like apt-get or yast don't work).

In the worst case, I will have to compile them all from source. Is there any better way to proceed? I've heard something about Enthought Python and Sage, but am not sure what is the best way to go.

Any suggestions?

+4  A: 

If you are an academic, you can use the Enthought distribution free of charge. It comes with its own installer and handles installation for you. This will definitely be easier than installing matplotlib etc. from scratch on your own. There is no requirement for admin access on the installation machine because the distribution provides its own Python binaries. I've used it and found it simple and convenient.

ire_and_curses
+1  A: 

I'd personally go for Sage on the basis of price. The main issue you will need to contend with is making sure you use your python install to access your libraries, regardless of the python suite you're using.

John Percival Hackworth
+2  A: 

python(x,y) is a free Python distribution similar to EPD (Enthought Python Distribution). While both include the basic standard libraries there are some differences, so you should find out which one is a better fit for your needs. One interesting aspect of EPD is that it recently adapted the Intel MKL library, so there might be performance advantages over both pythonxy and the standard numpy installer.

I don't know how these distributions work on a Unix box without root access, this is something you might just have to try out.

Sage on the other hand isn't focused on being a distribution (see the Wikipedia page), so you can't really compare it.

nikow
+5  A: 

EPD (Enthought Python Distribution) is great, but even for academics, you can only get the 32-bit version free of charge. If you intend to do anything ram-intensive, it's not really an option.

On the other hand, the Intel MLK library does make a difference, and it has lots of nifty (e.g. the latest version of mayavi) things built that can otherwise be a real pain to build from source. Also, as others have said, you can just untar it into your home folder and run it. You shouldn't need root access.

EPD is an absolutely great option if you don't ever need to use more than 2GB of ram, but you will have to pay to get 64-bit builds.

Python(x,y) is great if you're on windows, but otherwise, good luck finding the linux pre-built binaries. They more-or-less no longer exist... The ubuntu repository seems to be permanently down, and I don't know of anywhere to get a pre-compiled tarball for it anymore. This may all change in the near future, though... Hopefully it does, because it would be a great option for you!

Honestly, if you just need numpy, scipy, and matplotlib, they're relatively easy to build from source (especially so if you can get away without scipy), and you can always just build your own python interpreter and then use easy_install to avoid having to build them from source. This, of course, assumes that a basic build environment (gcc, etc) are already installed on the machine you're using... That's what I've done when I was in your situation, anyway...

If you go that route, it's best to download the python source code and build your own python interpreter that you'll use for everything. Then install setuptools and easy_install the rest. (Alternately, you can download the source code for numpy, etc and build and install them in for the python interpreter you just built.)

This shows a basic idea how to build the basics (python, numpy, scipy, matplotlib, ipython) under a directory called "pythondist" in the current working directory.

#! /bin/sh

builddir=$(pwd)/pythondist
mkdir -p $builddir/source
cd $builddir/source

wget 'http://python.org/ftp/python/2.6.5/Python-2.6.5.tgz'
wget 'http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e'
tar -xvzf Python-2.6.5.tgz

# Build python
cd $builddir/source/Python-2.6.5/

# The --prefix argument is the key!
./configure --prefix=$builddir

# Be sure to speed things up with the -j option if you're 
# on a multicore machine (e.g. make -j 4 build for a quadcore)
make build 
make install

# Now install setuptools
cd $builddir/source
tar -xvzf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11/

# The next key is to call this with the python you just built!
$builddir/bin/python setup.py build
$builddir/bin/python setup.py install

# Now just install numpy, scipy, ipython, matplotlib, etc through easy_install
$builddir/bin/easy_install numpy
$builddir/bin/easy_install scipy
$builddir/bin/easy_install matplotlib
$builddir/bin/easy_install ipython

EDIT: Minor typos in script. If numpy or scipy doesn't install properly from the egg, see the install notes.

This script is mainly intended to demonstrate building an independent python in your home directory, and assumes the system you're building on has the proper dependencies already installed, but it at least points you in the right direction.

If numpy or scipy don't build properly using easy_install, download the source tarballs and try building building them from there using different arguments. (Numpy/Scipy's setup.py autodetecting the wrong fortran compiler is common problem, in my experience) E.g.

cd $builddir/source
wget http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1.tar.gz/download
tar -xvzf numpy-1.4.1.tar.gz
cd numpy-1.4.1/
# If you don't specify an action (e.g. "build") this will enter an interactive
# mode to help diagnose problems... See the INSTALL.txt file, too!
$builddir/bin/python setup.py 

For example, on my OpenSUSE 11.2 system, I need to specify "--fcompiler=gnu95" when building numpy and scipy, as I have both g77 and gfortran installed. Otherwise things won't build correctly.

However, on an older RHEL 3 system, it builds perfectly as-is from easy_install. YMMV, of course. Good luck!

Joe Kington
+1  A: 

I use Sage on a daily basis. I'm a big fan, but I wouldn't recommend it if you're not prepared for lots of updating, tweaking, and configuring. It's not ready for prime time yet.

If you're willing to put in the effort to get it running and keep it running, the web notebook interface is amazing. I can't imagine that you would be able to get it running without root access though.

ptomato
+1  A: 

You can use virtualenv to create your virtual isolated env wihtout any access and then call easy_install to install (and compiling if necessary) automatically all the libs you need in your current directory without admin rights.

Installing matplotlib with virtualenv

The only condition is to be able to run virtual env, given that you can't install anything. You will have to donwload it as a archive and call virtualenv.py manually.

e-satis
+1  A: 

SageMath is completely free (GPL compatible), and the first of the three main goals of the project is to be a self-contained distribution of open source math software, which is easy to install from source (or from a binary), despite its large size. You should be able to setup Sage or anything else in Sage (e.g., the web notebook) without needing root access.