Front Matter

Copyright © 2002,2005,2017 The pygsl Team.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in section gun-free-doc entitled “GNU Free Documentation License”.

System Requirements, Installation

Status of GSL-Library

The gsl-library is since version 1.0 stable and for general use. More information about it at http://www.gnu.org/software/gsl/.

Status of this interface

Nearly all modules are wrapped. A lot of tests are covering various functionality. Please report to the pygsl-discuss mailing list if you find a bug.

The hankel modules have been wrapped. Please write to the mailing list pygsl-discuss if you require one of the modules and are willing to help with a simple example. If any other function is missing or some other module (e.g. ntuple) or function, do not hesitate to write to the list.

Retriving the Interface

You can download it here: http://sourceforge.net/projects/pygsl

Requirements

To build the interface, you will need
Supported Platforms are:
  • Linux (Redhat/Debian/SuSE) with python2.* and gsl-1.*

  • Win32

  • MacOS X

But is is supposed to build on any POSIX platforms.

Installing the pygsl interface

The gsl-config must be on your path on posix platforms. Then type:

# unpack the source distribution
gzip -d -c pygsl-x.y.z.tar.gz|tar xvf-
cd pygsl-x.y.z
# do this with your prefered python version
# to set the gsl location explicitly use setup.py --gsl-prefix=/path/to/gsl
# First configure pygsl interface
python setup.py config
#
python setup.py build
# change to an user id, that is allowed to do installation
python setup.py install

Ready….

Do not test the interface in the distribution root In this case python will search for all modules in the distribution directory pygsl.

If you find unresolved symbols later on, delete the C source in the swig_src files. Check that swig can be called from the command line. Then start the build process again.

In this case swig will rebuild the C files. The swig_src files distributed with pygsl are to an up to date version of GSL (2.4 as of this writing). Swig parses partly some header header files and builds the appropriate interface functions. If you have an older GSL version locally installed, the sources in the swig_src directory can contain links to symbols which are not defined by the locally installed GSL version.

Building on win32

Windows by default does not allow to run a posix shell. Here a different path is required. First change into the directory gsl_dist. Copy the file and edit it to reflect your installation of GSL and SWIG if you want to run it yourself. The pygsl windows binaries distributed over http://sourceforge.net/projects/pygsl/ are built using the mingw compiler.

Building the GSL library

In a first step install Msys http://www.msys2.org/ . Execute the commands given in the shell script below (it is also given in doc/win/pygsl_msys2_prepare.sh or can be dowloaded here):

#!/bin/sh
# It can be that you have to make python ready for handling msys2
# # python handling of the Microsoft C libary msvcr 
# # needs to be handled by    
# pacman -S patch
# # Do I need that ... if I hack on numpy
# # Some patch for msvcr 
# # Now put into two patches
# wget.exe https://bugs.python.org/file40608/patch.diff
# cd /c/LocalPrograms/Python36/Lib/distutils
# patch  -p0 < /c/Users/mfp/Devel/patch.diff

# Make sure that the build system is installed
pacman -S make
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-lld
pacman -S tar


# A build directory
mkdir Devel
# A directory to install the GSL library to
mkdir local

# The location of the tar balls. 
GSL_DIST_FILE=`pwd`/Downloads/gsl-2.3.tar.gz
PyGSL_DIST_FILE=`pwd`/Downloads/pygsl-2.2.0.tar.gz

# I assume that GSL has to be built. lets get started
cd Devel
tar zxvf "$GSL_DIST_FILE"
pushd  gsl-2.3/
# include the gcc path ...
# if one uses the environment variable CC the configure script does not
export PATH=$PATH:/mingw64/bin
./configure --enable-shared=no --disable-shared --prefix=`pwd`/../../local/
make
make install
popd
# Assuming that it has been successful!


$ tar zxvf "$PyGSL_DIST_FILE"
echo "pygsl is now built using pygsl_windows_compile.bat"
echo "Start it from the command shell!"

This will build gsl using the mingw compiler.

Building the pygsl interface

Copy the file gsl_dist/gsl_site_example.py to gsl_dist/gsl_site.py. Edit it so that it reflects your installation. Now open a windows command shell. An example batch file is found at doc/win/pygsl_windows_compile.bat or can be downloaded here. Change it to your needs and start it from the command shell.

@echo off
rem Batch processing file for building pygsl with mingw64 from msys2

rem The path to your python installation
set MYPYTHONDIR=C:\LocalPrograms\Python361\
rem set MYPYTHONDIR=C:\LocalPrograms\Python36-modified2\
rem set MYPYTHONDIR=C:\LocalPrograms\Anaconda3\

set PYTHONEXE=%MYPYTHONDIR%\python.exe
rem The path to your msys2 installation
set MSYS2PATH=C:\LocalPrograms\Msys2

set GSL_DIST_CONFIG=gsl_dist\gsl_site.py
if exist %GSL_DIST_CONFIG% (
	echo Is your %GSL_DIST_CONFIG% up to date?
) else (
	echo copy gsl_dist/gsl_site_example.py to %GSL_DIST_CONFIG%
	echo and edit it so that it reflects your gsl installation!
	
	exit /B 
)

rem gcc shall be in the search path
set PATH=%PATH%;%MSYS2PATH%\mingw64\bin;
set LIBRARY_PATH=%MYPYTHONDIR%;

rem config now possible on windows :-)
rem lets see what your GSL installation provides
%PYTHONEXE% setup.py config --compiler=mingw32
rem %PYTHONEXE% setup.py gsl_wrappers

rem build the code
%PYTHONEXE% setup.py build --compiler=mingw32

rem and make the installer
%PYTHONEXE% setup.py build --compiler=mingw32 bdist --formats=msi

Uninstall GSL interface

rm -r “python install path”/lib/"pyhon version"/site-packages/pygsl

Testing

The directory tests contains several testsuites, based on python unittest. The script run_test.py in this directory will run one test suit after the other. Alternatively you can run

python setup.py nosetests

Support

Please send mails to our mailinglist at pygsl-discuss

Development

At last the development tree was migrated to git. You can browse our git tree at https://sourceforge.net/p/pygsl/GitRepro/ci/master/tree/

Type this to check out the repository:

git clone https://git.code.sf.net/p/pygsl/GitRepro pygsl-GitRepro

Some wrappers use swig http://swig.org ; thus a runnable recent swig is a perequisite. The wrapper code which is distributed together with the source is built using swig-3.

PyGSL provides tools for generating the wrapper code from source files. These tools can be executed by

python setup.py gsl_wrappers

Currently the wrapper code is generated for special functions. These are wrapped as numpy universal functions.

ToDo

  • complete implementation of modules

  • documentation

  • examples

  • test suits

History

  • a gsl-interface for python was needed for a project at

  • Center for Applied Informatics Cologne http://www.zaik.uni-koeln.de/AFS

  • gsl-0.0.3 was released at May 23, 2001

  • gsl-0.0.4 was released at January 8, 2002

  • gsl-0.0.5 was growing since January, 2002

  • gsl-0.2.0 was released at

  • gsl-0.3.0 was released at

  • gsl-0.3.1 was released at

  • gsl-0.3.2 was released at

  • gsl-0.9.4 was released at 25. October 2008

Thanks

  • Jochen Küpper for pygsl.statistics

  • Fabian Jakobs for pygsl.blas, pygsl.eigen, pygsl.linalg and pygsl.permutation

  • Leonardo Milano for rpm build

  • Eric Gurrola and Peter Stoltz for testing and supporting the port of pygsl to the MAC

  • Sebastien Maret for supporting the Fink http://fink.sourceforge.net port of pygsl.

  • and all for support by providing feed back on testing or showing by email that the code is useful for them