source: anuga_core/documentation/install_win32_python25.txt @ 5511

Last change on this file since 5511 was 5198, checked in by jack, 16 years ago

Added documentation describing how to build ANUGA for Python2.5 on Win32.

File size: 4.1 KB
Line 
1Setting up ANUGA with Python 2.5 on Win32 using MinGW
2=====================================================
3
4NOTE: Shell examples all use the MSYS bash shell. You'll need MSYS
5anyway to build NetCDF, so I don't see this as a huge problem.
6
71. Get Python2.5
8
9I used the Enthought python distribution from
10(http://enthought.com/products/epd.php), as building VTK on Win32 with
11MinGW appears to be very difficult, if not impossible.
12
132. Get MinGW/MSYS from http://mingw.org
14
15ANUGA requires MinGW anyway, but MSYS is needed for the source build
16of NetCDF.
17
183. Uninstall ScientificPython
19
20Enthought's version of ScientificPython doesn't have the NetCDF
21interface. It needs to be removed before the new one can be built.
22
23Remove C:\Python25\Lib\site-packages\Scientific....egg directory.
24
254. Install NetCDF from source
26
27Get the NetCDF sources from
28(http://www.unidata.ucar.edu/downloads/netcdf/index.jsp). Unpack them
29somewhere (I used c:\code\build). Fire up an MSYS shell and cd to the
30top of the NetCDF directory. Building the NetCDF DLL requires some
31specific compiler flags, or else you get strange errors where the
32compiler is unable to determine sizeof(struct stat).
33
34$ CFLAGS='-march=i686 -O2 -pipe -fomit-frame-pointer -D__MSVCRT_VERSION__=0x0601' ./configure --enable-dll --disable-f77 --disable-cxx --disable-examples --disable-utilities --enable-shared --disable-static --prefix=/c/netcdf
35$ make
36$ make check
37$ make install
38
39This will install the stuff into c:\netcdf. The ScientificPython build
40scripts get confused and try to copy a `netcdf.dll', when this produces
41a `libnetcdf-4.dll', so make a copy so it doesn't choke:
42
43$ cp /c/netcdf/bin/{libnetcdf-4.dll,netcdf.dll}
44
455. Install Numeric from source
46
47The age of the Numeric package means that it's not in the Enthought
48distribution, but we need it for ANUGA.
49
50Grab the last Numeric sources (24.2) from
51(http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=1351),
52extract somewhere and build using distutils:
53
54$ python setup.py build -c mingw32 install
55
566. Install ScientificPython from source
57
58Grab ScientificPython from
59(http://sourcesup.cru.fr/frs/?group_id=180&release_id=966) and extract
60somewhere.
61
62The setup.py needs to be fixed, as it makes some bad assumptions about
63the NetCDF prefix layout. I present a unified diff of the changes.
64
65diff -u ScientificPython-2.7.8.a/setup.py ScientificPython-2.7.8/setup.py
66--- ScientificPython-2.7.8.a/setup.py   Fri Nov 30 05:07:37 2007
67+++ ScientificPython-2.7.8/setup.py     Fri Mar 28 12:30:50 2008
68@@ -82,8 +82,8 @@
69         if netcdf_dll is None:
70             print "Option --netcdf_dll is missing"
71             raise SystemExit
72-        netcdf_include = netcdf_prefix
73-        netcdf_h_file = os.path.join(netcdf_prefix, 'netcdf.h')
74+        netcdf_include = os.path.join(netcdf_prefix, 'include')
75+        netcdf_h_file = os.path.join(netcdf_include, 'netcdf.h')
76         netcdf_lib = netcdf_dll
77         data_files.append(('DLLs', [os.path.join(netcdf_dll, 'netcdf.dll')]))
78         scripts.append('scientific_win32_postinstall.py')
79@@ -97,7 +97,7 @@
80                              ['Src/Scientific_netcdf.c'],
81                              include_dirs=['Include', netcdf_include]
82                                           + arrayobject_h_include,
83-                             library_dirs=[netcdf_lib],
84+                             library_dirs=[netcdf_lib, os.path.join(netcdf_prefix, 'lib')],
85                              libraries = ['netcdf'],
86                              extra_compile_args=extra_compile_args)]
87
88Compile and install ScientificPython:
89
90$ NETCDF_PREFIX=/c/netcdf python setup.py --netcdf_dll=c:\\netcdf\\bin
91build -c mingw32 install
92
93The install process for ScientificPython copies netcdf.dll into
94C:\Python25\DLLs (or whatever the Python root is). This will cause
95breakage as it's linked against libnetcdf-4.dll. Fix this:
96
97$ mv /c/Python25/DLLs/{netcdf.dll,libnetcdf-4.dll}
98
99Run the ANUGA unit tests to make sure that it works. If everything's
100good, the source directories and the installed path for NetCDF can be
101removed.
Note: See TracBrowser for help on using the repository browser.