Cygwin

Cygwin is a way to have the native linux environment on windows. Refer to the main Cygwin page to find out what Cygwin is and what is not. There you can also download the installer, which is available for both 32/64bit windows versions.

Python

Jump to: numpy, scipy, matplotlib, basemap, ipython, PyX, netcdf4-python

The packages I always install for python usage are: numpy, scipy, matplotlib, basemap, ipython, PyX and netcdf4-python. Note that although numpy exists as a Cygwin package, I still prefer to build it from source. In addition, although scipy can read netcdf files, I prefer the netcdf4-python package, since it is much faster in reading files with thousands of variables.

In order to use python modules in any unix environment, one should set a few things up in their shell. In bash, I use this:

export PYTHONPATH=.:${HOME}/python/lib/python2.7/site-packages
which means that I will use --prefix=${HOME}/python in every python module installation, and I use python2.7. The steps to install python modules are the same for all unix environments, but still they are outlined here, with a few cygwin tips, where needed. In my ${HOME} directory I create a python directory and in it a source one. In the source directory I download and build the modules I want to install. I create the directory like this:
mkdir -p ${HOME}/python/source

numpy

This is how I install numpy version 1.10.2. It should work with other versions, too.

cd ${HOME}/python/source
wget http://sourceforge.net/projects/numpy/files/NumPy/1.10.2/numpy-1.10.2.tar.gz
tar xzf numpy-1.10.2.tar.gz
cd numpy-1.10.2
python setup.py install --prefix=${HOME}/python
If you get this:
RuntimeError: Broken toolchain: cannot link a simple C program
you need to install the gcc package; I always include gcc-fortran and gcc-c++ along with gcc. In order to test that everything works, move anywhere outside the source directory you currently are and run:
python -c "import numpy"
You should get no output, meaning no errors.

scipy

This is how I install scipy version 0.16.1. It should work with other versions. You need to have BLAS and LAPACK libraries installed, as well as numpy.
scipy-0.16.1: There is a bug in the code that does not allow compilation under cygwin. To fix it, you need to replace the exact word "infinity" with the word "Infinity" (case matters!) in all instances found in all files that complain about it during compilation. This tip comes with no warranty of any kind. Apply it at your own risk!

cd ${HOME}/python/source
wget http://sourceforge.net/projects/scipy/files/scipy/0.16.1/scipy-0.16.1.tar.gz
tar xzf scipy-0.16.1.tar.gz
cd scipy-0.16.1
python setup.py install --prefix=${HOME}/python
In order to test that everything works, move anywhere outside the source directory you currently are and run:
python -c "import scipy"
You should get no output, meaning no errors.

matplotlib

This is how I install matplotlib version 1.2.1. It should work with older versions, but I was not successful in building version 1.3.0 as of now. You need to have numpy and scipy installed.

cd ${HOME}/python/source
wget http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.2.1/matplotlib-1.2.1.tar.gz
tar xzf matplotlib-1.2.1.tar.gz
cd matplotlib-1.2.1
python setup.py install --prefix=${HOME}/python
If you get something like:
In file included from src/ft2font.cpp:3:0:
src/ft2font.h:16:22: fatal error: ft2build.h: No such file or directory
 #include <ft2build.h>
                      ^
compilation terminated.
error: command 'gcc' failed with exit status 1
or
src/_png.cpp:23:20: fatal error: png.h: No such file or directory
 #   include <png.h>
                    ^
compilation terminated.
error: command 'gcc' failed with exit status 1
or
In file included from src/_tkagg.cpp:33:0:
/usr/include/tk.h:76:23: fatal error: X11/Xlib.h: No such file or directory
 # include <X11/Xlib.h>
                       ^
compilation terminated.
error: command 'gcc' failed with exit status 1
you probably don't have all cygwin required packages installed. Add the packages libfreetype-devel, python-gtk2.0, python-tkinter, libpng-devel and libX11-devel and try again the last (setup) command. In case you get other errors, they might be related with the GUI support. Check the most probable solution here. In order to test that everything works, move anywhere outside the source directory you currently are and run:
python -c "import matplotlib"
You should get no output, meaning no errors.

basemap

This is how I install basemap version 1.0.7. It should work with other versions. You need to have the GEOS library installed, as well as numpy, scipy and matplotlib.

cd ${HOME}/python/source
wget http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz
tar xzf basemap-1.0.7.tar.gz
cd basemap-1.0.7
python setup.py install --prefix=${HOME}/python
In order to test that everything works, move anywhere outside the source directory you currently are and run:
python -c "import mpl_toolkits.basemap"
You should get no output, meaning no errors.

ipython

This is how I install ipython version 1.1.0. It should work with other versions.

cd ${HOME}/python/source
wget http://archive.ipython.org/release/1.1.0/ipython-1.1.0.tar.gz
tar xzf ipython-1.1.0.tar.gz
cd ipython-1.1.0
python setup.py install --prefix=${HOME}/python
In order to test that everything works, move anywhere outside the source directory you currently are and run:
ipython
You should get the ipython prompt.

PyX

This is how I install PyX version 0.12.1. It should work with other versions.

cd ${HOME}/python/source
wget http://sourceforge.net/projects/pyx/files/pyx/0.12.1/PyX-0.12.1.tar.gz
tar xzf PyX-0.12.1.tar.gz
cd PyX-0.12.1
python setup.py install --prefix=${HOME}/python
In order to test that everything works, move anywhere outside the source directory you currently are and run:
python -c "import pyx"
You should get no output, meaning no errors.

netcdf4-python

This is how I install netcdf4-python version 1.0.6. It should work with other versions, but not 1.0.5, which has a bug that was resolved in version 1.0.6. You need to have the libhdf5-devel and libnetcdf-devel packages installed, or the netcdf library (for Cygwin-x86_64).

cd ${HOME}/python/source
wget http://netcdf4-python.googlecode.com/files/netCDF4-1.0.6.tar.gz
tar xzf netCDF4-1.0.6.tar.gz
cd netCDF4-1.0.6
python setup.py install --prefix=${HOME}/python
If you get something like:
Traceback (most recent call last):
  File "setup.py", line 164, in 
    raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
you need to install the Cygwin package libhdf5-devel and run the last (setup) command again. If you get something like:
Traceback (most recent call last):
  File "setup.py", line 188, in 
    raise ValueError('did not find netCDF version 4 headers')
ValueError: did not find netCDF version 4 headers
you need to install the libnetcdf-devel package (for Cygwin-x86) or netcdf library (for Cygwin-x86_64). In order to test that everything works, move anywhere outside the source directory you currently are and run:
python -c "import netCDF4"
You should get no output, meaning no errors.