Site navigation:
Further information about the package dependencis mentioned here can be found from the page Numeric And Scientific at the main python site. Depending on your platform, which you should first read about below, you have multiple options for installing python and the small number of other dependencies.
This version series requires Python 2.6-7 or 3.3+. Further support for 2.6 has been removed. Installation and setup is best achieved by pip install pydstool (from pypi) or using Debian's apt-get. You can also download the installer package from github or sourceforge, then run sudo python setup.py install from within that directory.!
On older Mac systems, and especially if you still use the fink package manager as the basis of your python installation, you may need to coerce the OS to install as a 32-bit package, and use 'sudo' (super user do) to enable permission to write to a system-controlled location for python's site-packages directory. If so, you might need to install with a command such as:
sudo ARCHFLAGS="-arch i386" FFLAGS="-m32" CFLAGS="-m32" LDFLAGS="-m32" ARCH="i386" pip install PyDSTool. Equally, you put those environment variable flags into your .bashrc or similar startup script using EXPORT. After such a pip command, you will also have to visit your site-packages and set all users to have read and execute permissions, using sudo chmod -R a+rx PyDSTool*
Further details about dependecies and sources are given in the README included with the package, which is also displayed here. A FAQ is also provided in the package.
PyDSTool requires Python version 2.4-2.7 (download it here). It is not yet tested on later versions (3.x) and will not work. I will fix this in due course. Multiple versions of python can usually be installed on a machine concurrently, although I don't recommend it.
PyDSTool relies on the following packages, which can be installed in this order over Python before using PyDSTool:
numpy: version 1.0.1 or later is recommended. May not work with the latest version.
scipy: version 0.5.2 or later is recommended. May not work with the latest version.
MatPlotLib: version 0.91 or later because of the way it has been wrapped, in particular its use of Python callback functions and the overhead created in being able to detect events using this solver using our pure Python code.
SWIG: version 1.3.25 or later is recommended. The most recent version should be fine.
gcc version 3.3 or later (including g77 or gfortran))
64 bit machines with 64 bit operating systems should function correctly with PyDSTool v 0.90 and later, but there may be problems on windows machines that cannot get the 64 bit version of MinGW to install.!
For earlier versions of PyDSTool, users report a variety of successful and unsuccessful outcomes in their installations. In some cases, this is a limitation of how your numpy and python were installed (especially through Fink on a Mac). If you must use these earlier PyDSTool versions, scientifically-oriented Python from ActiveState, Enthought (free for academic use), or Anaconda to be preferable. Some problems with setup have been discovered with these systems, particularly to get the C integrators working in 64-bit mode especially. Always install in 32-bit mode. However, installation of the individual components from binary installers is very simple on windows, and gives you more control over the versions that will be most compatible with the current PyDSTool version.
Note that you may have problems using Windows pathnames to your PyDSTool code that use whitespace when you test the C integrators. Distutils and/or MinGW does not correctly deal with this case and you will get cryptic errors about missing files.
For the oldest versions of PyDSTool (pre 0.84),.
Main solution: don't use Vista!25)25; to the front of the existing string. Then press Ok and its ready to go. It should look something like C:\Python25;%\...........
d. Some people have reported that they need to put the C:\Python25 in double quotes... i.e. "C:\Python25";
There are known problems with the PyWin32 libraries on Windows Vista which can make using python IDE functionality and graphics through IPython or PyScripter problematic.
Additionally, Python 2.5's distutils has some problems building extensions for the C-based integrators if you use path names that include spaces. I don't know if these problems have gone away for Python 2.6, but it is hard to patch distutils to fix this, and you would be better off changing your filespace to avoid spaces in filenames.
You will need to have installed XCode on your Mac. There is an installation disk for "Developer Tools" that comes with your Mac. You can install it from there, or download the latest version from Apple. (Getting the very latest version is not important.) However, it is very important not to install python packages into the system Framework's python. That should be left alone for the OS to use by itself. It is easy to install a co-existing python system.
You have a couple of options now for installing everything on a Mac. My recommended way is now to use "homebrew". Tested instructions are here, which sets you up with the whole scipy stack, the compilers, and OS environment variable setup. It may take quite a while to build the compilers! After that, you can simply use pip install pydstool.
An older approach, that can still work (I still use it on one of my machines) is through the "fink" package manager. You will need to have a superuser (root) account activated for fink to be able to install dependency python packages by itself. Instructions are here. I strongly recommend installing everything via your user account and selecting the 'sudo' option for fink to use the root account to make changes. You will have to give it the root password. Fink will then create a /sw directory where everything will be installed. You must ignore the python system in Framework because it's harder to configure and adapt that to our needs.
Fink-specific information:
To install with fink, I recommend the command line interface only. In a terminal window:
$ fink configure
in which you must select the use of the "unstable" branch of packages in order to get access to numpy, etc. This is not sketchy in the way that it sounds! Alternatively, if it's unclear to you how to select the unstable branch then download and install the Fink Commander application, run it and merely use its File->Preferences->Fink tab to select "Use unstable branch" and apply the changes. Then run
$ fink install scipy-py27 matplotlib-py27 ipython-py27
which may take one or more hours to complete, depending on your computer. Fink will install many dependencies (including numpy) automatically, and you can simply select all the defaults when you are queried. This will also install the optional ipython environment, which is highly recommended for use with matplotlib. Conveniently, these commands will install gcc, gfortran, and SWIG, which are necessary to run the C-based integrators Dopri and Radau and work with the AUTO package. Lastly, see the additional set-up notes below for OS X / Linux.
With fink, you will probably need to update your PATH environment variable and/or aliases in your .profile or .bashrc file (or equivalent) so that the newly-installed version is default. Edit $HOME/.profile to read like the following (adjust python version as appropriate):
. /sw/bin/init.sh
export PYTHONPATH=/sw/lib/python2.7/site-packages:$HOME/
export PYTHON=/sw/bin/python2.7
alias python='/sw/bin/python2.7'
The first line is for Fink.
The second line allows your new Python system to find modules, including PyDSTool.
The third line lets PyDSTool know which Python to execute.
The last line is a shortcut so that you start with the correct Python.
1.1.6. Working platforms
See the list on the Travis CI page. We are still having problems with fully 64-bit builds on Windows machines when python is installed with Anaconda or Python(x,y), whose binaries typically used a Microsoft compiler that is not compatible with the gcc-built PyDSTool fast integrators. For now, one solution is to install the same MS compiler, or build your whole python system using gcc (from MinGW or Cygwin) from source. Please see the discussions on the Sourceforge forums.
MatPlotLib is the 2D graphics library used by PyDSTool at present. MatPlotLib is the de facto standard for 2D graphics in Python, and there are some extensions (automatically done with fink/homebrew on a Mac). unless you have gfortran.
Some parts of PyDSTool versions pre-0.90 can also take advantage of Psyco optimization, although this only works for x86 platforms. (Note that Psyco is no longer maintained.)
There are many excellent resources online for comparing IDE features and styles.
At minimum,. We recommend Wing IDE or PyCharm for general editing and debugging, which has excellent support for small and large projects. A simple Windows alternative is PyScripter, while a simple Mac alternative is Spyder.
Note that on Windows you may need to install pyreadline, and the PyWin32 tools for optimum use of IPython (and ctypes for older Python versions pre-2.5). Latest versions of these tools can be found on SourceForge.
The PyDSTool package does not need to be installed per se. You simply unzip it to its target directory (e.g., c:\PyDSTool\ on Windows or /Users/$HOME/ on a Mac). No call to setup (part of the distutils package) is necessary (and you do not have to copy the code to Python's lib\site-packages directory). We aim to provide a setup.py installer in version 0.90. You should not use any spaces in your path to PyDSTool if you plan to use the C-based integrators -- gcc will not work properly! This means, do not put it in your Windows "Documents and Settings" folder!. This should not be necessary unless you are not the installing user and someone put PyDSTool in a root-owned folder (e.g. in python's site-packages).
The most recent versions of MatPlotLib should work correctly with interactively plotting by default. On a Mac or Linux installation with MatPlotLib 0.8x, the default setup may have problems with interactive plotting. For instance, we had to close the plot window to get back to the python prompt, precluding having more than one plot window open at at time. Try it as it is first, and if it works interactively then you can ignore this section.
To fix this on your system, I recommend changing the back-end used for windowing to be the highly reliable TkAgg. To do these things, download a copy of my .matplotlibrc file provided here. You can place this in your home directory's .matplotlib (hidden) directory, which will now override the built-in default rc file for matplotlib. Read more about this here. (On binary-only linux/OSX installations, the default rc file may be in /etc if you really want to edit that).
Only on older systems: If you are.
Also, making this change fixes a problem with XWindow session forwarding -- now local plotting graphs created on a remote terminal works if you have used ssh -X to login to the remote machine.
Lastly: will not need to follow these instructions to use the inbuilt (scipy-provided) VODE integrator or if you installed on a Mac with fink.
SWIG is a wrapper for C/C++ sources. It allows you to use C/C++ functions and classes from withing Python with a minimum effort.
Download SWIG from. Follow the instructions to compile and build the package.
PyDStool's Radau integrator has had compatibility problems with version 4.0 of gcc, but since 2012 has been OK with later versions and 3.5. If you are expecting to use gcc to compile C code versions of vector fields (e.g. with the Dopri integrator), and you have any problems on linux, then you should ensure that the CC variable is set to gcc in the Python installation Makefile
<python_installation_root>/lib/python227)
If it has been created, your matplotlibrc file can probably be found in C:\Python27\share\matplotlib\, otherwise download a sample file provided here. You can read more about this here. This file selects the highly reliable TkAgg backend and sets the interactive option.
MatPlotLib configuration problems will depend on which IDE you choose. We recommend using IPython (with the -pylab option built into your shortcut) or IDLE (with the -n option built into your shortcut -- see below).
Instructions for IDLE:
In the start menu, change the properties for the link to idle from
C:\Python27\pythonw.exe "C:\Python27\Lib\idlelib\idle.pyw"
to
C:\Python27\pythonw.exe "C:\Python27\Lib\idlelib\idle.pyw" "-n"
For IPython:
To fix interactive plotting on your system, you might want to change the back-end used for windowing:
2. Change the "backend" line in your matplotlibrc file to TkAgg (unfortunately this option may not be compatible with the PythonWin IDE).).
The most recent versions of MinGW include versions of gcc are compatible with the SciPy runtime libraries. If you have problems, you can try using versions of MinGW before 3.3, (you'll have to search for that online). PyDSTool from an earlier version, and you have previously saved PyDSTool or Scipy data objects, you may be able to still use loadObjects, etc. to load the data. You should keep your original scripts that generate these files in case you have to re-run them all using your new version. That is the most reliable and easiest solution. Cross-version support for the binary data files is, unfortunately, not provided, but if you insist on trying then you should try the following procedure. Load each of the saved objects you wish to convert and export all their metadata dictionaries and their arrays to their own files, then reimport those and repopulate new objects after loading them in the new version of PyDSTool. You will have to manually check that you covered all the attributes in those objects.
For pre 0.84 PyDSTool versions:.
There are a number of unit tests included in the sub-directories of PyDSTool named tests/ and also a number of usage examples in the outer examples directory..
Once you have set up your system you may like to run all the tests in batch mode. This can be done by running the script /examples/run_all_tests.py, e.g. by calling python -i run_all_tests.py from the prompt, in the tests directory. There are simple switch options or gfortran).
PyDSTool has been successfully tested on the popular 32-bit platforms, based on the instructions given on this page (and some 64-bit platforms - see above notes). If you cannot understand why you still have problems after carefully following the above instructions then please post a message on the main User Help forum. That is preferred to emailing for general installation and setup enquiries. Please save the logs created when running the tests, and be ready to explain exactly how you installed everything so far so that I can understand what help you need.
In this section we will assume that you have set up PyDSTool successfully, and that you are already familiar with using Python, SciPy, and NumPy. Tutorials on these can be found at, a SciPy/NumPy tutorial, and a basic NumPy tutorial. If you are used to an environment such as Matlab rather than Python, you might like to consult this page about NumPy for Matlab users. See also the PythonResources page..
Many.
PyDSTool's API command returns a string containing all the (non-underscored) attributes and methods of an object, with their docstrings where available. The full API documentation of all PyDSTool functions, classes, constants, etc. is provided in the bundled auto-created HTML documentation (see the local README file to get started).
We will assume you have installed the whole package to the directory PyDSTool_package, in which there are setup metadata, the main PyDSTool directory, and the examples directory.
cd PyDSTool_package/examples python -i interp_vode_test.py
For an interactive session, the principal import statement in a user script is
from PyDSTool import *
from which most of the names from scipy, numpy, and math, become available without prefixing, in addition to the core PyDSTool names. For convenience, scipy, numpy, and matplotlib's pyplot modules are accessible using the shorthands sp, np, and plt, respectively.
There are two sources of further help. Primarily, there is a growing online Tutorial. For a wider range of examples, you are encouraged to read and run the other examples in the PyDSTool/tests/ directory. Many of these contain significant code commenting to explain the set ups, and also display graphs and text-based information about the examples.
PyDSTool source code is hosted by SourceForge: