Difference between revisions of "Modules:FourDAnalysis-Documentation-3.6-SciPy-Memo"
Line 3: | Line 3: | ||
=Installation= | =Installation= | ||
+ | |||
+ | Please refer [http://www.scipy.org/Installing_SciPy the official SciPy website] for the instruction. The following sections describe the author's experience of installing SciPy in 3D Slicer. | ||
+ | |||
==Mac OS X (tested on 10.6.7)== | ==Mac OS X (tested on 10.6.7)== | ||
+ | The following steps were based on the following web page, but modified for 3D Slicer | ||
+ | * http://www.scipy.org/Installing_SciPy/Mac_OS_X | ||
+ | * http://blog.hyperjeff.net/?p=160 | ||
+ | |||
+ | ===Before Installation...=== | ||
+ | If you have MacPorts or any other UNIX package manager, please make sure that your environment variable PATH doesn't contain any paths to those directories. For example, do not have /opt/local/bin in Mac OS with MacPort installed. Some tools in those paths may screw up the installing process. | ||
+ | |||
+ | ===Install GNU Fortran=== | ||
+ | To build SciPy, you need to have GNU Fortran compiler. The official SciPy instruction recommends gfortran-4.2.3 available at [http://r.research.att.com] | ||
+ | |||
===Install 3D Slicer version 3 (latest revision)=== | ===Install 3D Slicer version 3 (latest revision)=== | ||
+ | Please follow [[Slicer3:Build_Instructions| the 3D Slicer Build Instructions]], except that: | ||
+ | * You download the latest source code instead of stable release branch. The latest source code is available in the subversion repository at http://svn.slicer.org/Slicer3/trunk | ||
+ | * Turn off NumPy by editing slicer_variables.tcl. The variable that controls NumPy building is around line 250. Please edit it as: | ||
+ | set ::USE_NUMPY "OFF" | ||
+ | |||
+ | ===Install UMF=== | ||
+ | We will use Slicer3-lib/python as a working directory. | ||
+ | First, obtain UMFPACK, UFConfig, and AMD: | ||
+ | cd ~/tmp | ||
+ | wget http://www.cise.ufl.edu/research/sparse/umfpack/current/UMFPACK.tar.gz | ||
+ | wget http://www.cise.ufl.edu/research/sparse/UFconfig/current/UFconfig.tar.gz | ||
+ | wget http://www.cise.ufl.edu/research/sparse/amd/current/AMD.tar.gz | ||
+ | tar xf AMD.tar.gz | ||
+ | tar xf UFconfig.tar.gz | ||
+ | tar xf UMFPACK.tar.gz | ||
+ | |||
+ | Before start building, configure UMFConfig/UMFConfig.mk: | ||
+ | F77 = gfortran | ||
+ | CFLAGS = -O3 -fno-common -no-cpp-precomp -fexceptions -arch x86_64 | ||
+ | LIB = -lstdc++ | ||
+ | BLAS = -framework Accelerate | ||
+ | LAPACK = -framework Accelerate | ||
+ | UMFPACK_CONFIG = -DNCHOLMOD | ||
+ | |||
+ | Then run the following commands: | ||
+ | cp UFconfig/UFconfig.h AMD/Include/ | ||
+ | cp UFconfig/UFconfig.h UMFPACK/Include/ | ||
+ | cd UMFPACK | ||
+ | make | ||
+ | |||
+ | This ends up with the following message, but just ignore the errors (?) | ||
+ | /usr/bin/ranlib: file: libumfpack.a(umf_di_dump.o) has no symbols | ||
+ | /usr/bin/ranlib: file: libumfpack.a(umf_dl_dump.o) has no symbols | ||
+ | /usr/bin/ranlib: file: libumfpack.a(umf_zi_dump.o) has no symbols | ||
+ | /usr/bin/ranlib: file: libumfpack.a(umf_zl_dump.o) has no symbols | ||
+ | ranlib libumfpack.a | ||
+ | ranlib: file: libumfpack.a(umf_di_dump.o) has no symbols | ||
+ | ranlib: file: libumfpack.a(umf_dl_dump.o) has no symbols | ||
+ | ranlib: file: libumfpack.a(umf_zi_dump.o) has no symbols | ||
+ | ranlib: file: libumfpack.a(umf_zl_dump.o) has no symbols | ||
+ | ( cd Demo ; make ) | ||
+ | ( cd ../../CHOLMOD ; make library ) | ||
+ | /bin/sh: line 0: cd: ../../CHOLMOD: No such file or directory | ||
+ | make[2]: *** No rule to make target `library'. Stop. | ||
+ | make[1]: *** [../../CHOLMOD/Lib/libcholmod.a] Error 2 | ||
+ | make: *** [all] Error 2 | ||
+ | |||
+ | ===Install NumPy/SciPy=== | ||
+ | We will use Slicer3-lib/python as a working directory as we did for UMF. First, download the source code: | ||
+ | $ git clone https://github.com/numpy/numpy.git | ||
+ | $ git clone https://github.com/scipy/scipy.git | ||
+ | $ cd numpy | ||
+ | |||
+ | To make NumPy with AMD and UMFPACK built above, copy site.cfg.example to site.cfg in the numpy directory | ||
+ | and put the following line: | ||
+ | [amd] | ||
+ | library_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/AMD/Lib | ||
+ | include_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/AMD/Include | ||
+ | amd_libs = amd | ||
+ | |||
+ | [umfpack] | ||
+ | library_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/UMFPACK/Lib | ||
+ | include_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/UMFPACK/Include | ||
+ | umfpack_libs = umfpack | ||
==Windows== | ==Windows== | ||
==Linux== | ==Linux== |
Revision as of 16:12, 27 April 2011
Home < Modules:FourDAnalysis-Documentation-3.6-SciPy-MemoContents
About this page
This is a memo on how to set up SciPy in 3D Slicer version 3, for those who are interested in 4D Analysis module. This page explains how to build SciPy package from the source. Please note that building SciPy is not always straightforward, due to its dependencies on other libraries e.g. BLAS, LAPACK, etc, and the author of this page cannot answer to questions regarding installation of SciPy. This page only provides the steps that worked for the author's computer environment for the users information.
Installation
Please refer the official SciPy website for the instruction. The following sections describe the author's experience of installing SciPy in 3D Slicer.
Mac OS X (tested on 10.6.7)
The following steps were based on the following web page, but modified for 3D Slicer
Before Installation...
If you have MacPorts or any other UNIX package manager, please make sure that your environment variable PATH doesn't contain any paths to those directories. For example, do not have /opt/local/bin in Mac OS with MacPort installed. Some tools in those paths may screw up the installing process.
Install GNU Fortran
To build SciPy, you need to have GNU Fortran compiler. The official SciPy instruction recommends gfortran-4.2.3 available at [1]
Install 3D Slicer version 3 (latest revision)
Please follow the 3D Slicer Build Instructions, except that:
- You download the latest source code instead of stable release branch. The latest source code is available in the subversion repository at http://svn.slicer.org/Slicer3/trunk
- Turn off NumPy by editing slicer_variables.tcl. The variable that controls NumPy building is around line 250. Please edit it as:
set ::USE_NUMPY "OFF"
Install UMF
We will use Slicer3-lib/python as a working directory. First, obtain UMFPACK, UFConfig, and AMD:
cd ~/tmp wget http://www.cise.ufl.edu/research/sparse/umfpack/current/UMFPACK.tar.gz wget http://www.cise.ufl.edu/research/sparse/UFconfig/current/UFconfig.tar.gz wget http://www.cise.ufl.edu/research/sparse/amd/current/AMD.tar.gz tar xf AMD.tar.gz tar xf UFconfig.tar.gz tar xf UMFPACK.tar.gz
Before start building, configure UMFConfig/UMFConfig.mk:
F77 = gfortran CFLAGS = -O3 -fno-common -no-cpp-precomp -fexceptions -arch x86_64 LIB = -lstdc++ BLAS = -framework Accelerate LAPACK = -framework Accelerate UMFPACK_CONFIG = -DNCHOLMOD
Then run the following commands:
cp UFconfig/UFconfig.h AMD/Include/ cp UFconfig/UFconfig.h UMFPACK/Include/ cd UMFPACK make
This ends up with the following message, but just ignore the errors (?)
/usr/bin/ranlib: file: libumfpack.a(umf_di_dump.o) has no symbols /usr/bin/ranlib: file: libumfpack.a(umf_dl_dump.o) has no symbols /usr/bin/ranlib: file: libumfpack.a(umf_zi_dump.o) has no symbols /usr/bin/ranlib: file: libumfpack.a(umf_zl_dump.o) has no symbols ranlib libumfpack.a ranlib: file: libumfpack.a(umf_di_dump.o) has no symbols ranlib: file: libumfpack.a(umf_dl_dump.o) has no symbols ranlib: file: libumfpack.a(umf_zi_dump.o) has no symbols ranlib: file: libumfpack.a(umf_zl_dump.o) has no symbols ( cd Demo ; make ) ( cd ../../CHOLMOD ; make library ) /bin/sh: line 0: cd: ../../CHOLMOD: No such file or directory make[2]: *** No rule to make target `library'. Stop. make[1]: *** [../../CHOLMOD/Lib/libcholmod.a] Error 2 make: *** [all] Error 2
Install NumPy/SciPy
We will use Slicer3-lib/python as a working directory as we did for UMF. First, download the source code:
$ git clone https://github.com/numpy/numpy.git $ git clone https://github.com/scipy/scipy.git $ cd numpy
To make NumPy with AMD and UMFPACK built above, copy site.cfg.example to site.cfg in the numpy directory and put the following line:
[amd] library_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/AMD/Lib include_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/AMD/Include amd_libs = amd [umfpack] library_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/UMFPACK/Lib include_dirs = <Path to the 3D Slicer working directory>/Slicer3-lib/python/umfpack/UMFPACK/Include umfpack_libs = umfpack