Windows: Custom installation

This page explains how to add Myokit to an existing Python distribution. It assumes you're comfortable with installing python packages and compiling C programs. If you prefer not to, you can also use the easy installation procedure.

Custom installation procedure

Install Python 2.7 and a modern C compiler

First, make sure you have a Python 2.7 installation. Myokit does not currently have Python 3 support.

Next, ensure Python has access to a good C compiler. In this guide, we're assuming you're using MinGW. It may also be possible to use Myokit with other compilers, such as a modern Visual Studio variant. At the time of writing, the free C compiler for Python released by Microsoft can only compile C files in the C89 standard, making it unsuitable for use with Myokit and CVODE.

In addition, you'll need at least the following Python pacakges:

Sundials installation

Download the source files for Sundials 2.4 or higher.

Unpack the sources using 7zip or a similar decompression program

Download and install gnu make

Download and install cmake

Run cmake (cmake-gui)

  1. Add the path to the source code, for example C:\sundials
  2. Add an arbitrary build path, for example C:\sundials\build
  3. Click "configure" and choose "MinGW Makefiles" and "Use default native compilers"
  4. In the displayed configuration options (all in red, for some reason) make sure BUILD_SHARED_LIBS is selected
  5. Now hit "Generate" to generate the build files for make

Close cmake and open a command prompt.

Users of Windows Vista, 7, 8 and up: You will need to run this prompt with administrative privileges. One way of doing this is hitting start, finding the command prompt in the menu (for example by typing cmd in the search bar), right-clicking the icon and selecting "Run as administrator".

If the build directory you created is located on a mapped network drive, the Administrator user might not be able to find it. The easiest work-around is to make sure both the source and the build path are somewhere simple, like C:\sundials and C:\sundials\build. You can delete these folders once you're done.

Now nagivate to the selected build directory and:

Myokit installation

Download and unzip myokit into a directory of your choice

Myokit 1.25.2

Using a command terminal, navigate to the Myokit directory and run the example script using:

python myo run example

If you see an action potential appear on your screen, the installation is complete!

If you weren't as lucky, and got the error message "Unable to find vcvarsall.bat", follow the instructions on http://stackoverflow.com/questions/2817869/. Specifically, create a file C:\Python27\Lib\distutils\distutils.cfg

[build]
compiler=mingw32

Note: Windows has a tendency to hide file types so that you may end up with a file that looks like distutils.cfg but is actually called distutils.cfg.txt (you can tell by right-clicking it and selecting "properties").

If you get a message about a missing CVODE.h file, Myokit doesn't know where to find sundials. To fix this, open Myokit's ini file (located either in your user directory or, if you're using WinPython, in the WinPython settings directory) and update the variables referring to Sundials.

Now try again. Still getting errors? Try rebooting, check the paths in Myokit's ini file and make sure Sundials' lib directory is included in the PATH environment variable.

Further questions

If you have any questions, please email Michael Clerx (michael@myokit.org) or check out the Myokit mailing list.