wiki:InstallPyCml

Installing PyCml to generate Chaste code from CellML

PyCml itself is a pure Python tool, but it does have 3 prerequisites: Amara, a RELAX NG validator, and an RDF library.

When using the chaste-source Ubuntu package, the prerequisites, and PyCml itself, should be installed for you automatically.

If you need to do a manual installation, read on.

Amara

If you have root access

This may be available in your Linux distribution, or it can be obtained via easy_install. Note that PyCml requires Amara 1.2.0.2, not the newer Amara 2 - check this if installing a distribution package.

If installing via easy_install, you may first need to install some system packages. Amara requires the expat library to parse XML:

sudo aptitude install expat libexpat1-dev

You will also need the Python header files:

sudo aptitude install python-dev
# On Ubuntu:
sudo aptitude install python-setuptools
# On other systems:
wget http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py

# On all systems:
sudo easy_install "python-dateutil==1.5"
sudo easy_install "Amara==1.2.0.2"

If using easy_install to install Amara fails (which doesn't happen very often), InstallingAmaraWithoutEasyInstall might be useful.

Non-root setup

Create ~/.pydistutils.cfg with the following content:

[install]
install_lib = /home/scratch/chaste-libs/lib/python
install_scripts = /home/scratch/chaste-libs/bin

This assumes that you have installed chaste libraries in /home/scratch/chaste-libs; edit the path if not.

Some paths need to be set such that programs installed in these locations can be used. Adding the following to your .bashrc file is likely to work:

export PATH=/home/scratch/chaste-libs/bin:$PATH
export PYTHONPATH=/home/scratch/chaste-libs/lib/python

Again, edit /home/scratch/chaste-libs to match your system.

Then proceed as follows (after reloading your .bashrc if necessary: source ~/.bashrc):

wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
easy_install "python-dateutil==1.5"
easy_install "Amara==1.2.0.2"

If using easy_install to install Amara fails (which doesn't happen very often), InstallingAmaraWithoutEasyInstall might be useful.

RELAX NG validator

As of r15854 Chaste includes support for lxml. This may be available in your distribution, or you can use easy_install.

  • Ubuntu/Debian systems: sudo apt-get install python-lxml
  • Fedora: sudo yum install python-lxml
  • Using easy_install: [sudo] easy_install --allow-hosts=lxml.de,*.python.org lxml

See http://lxml.de/installation.html for further details if required.

RDF library

In order to handle CellML metadata, an RDF library is needed. PyCml supports version 2 of RDFLib; the alternative Redland RDF library is now deprecated.

Ubuntu:

sudo apt-get install python-rdflib

Fedora:

sudo yum install python-rdflib

easy_install:

easy_install "rdflib==2.4.2"

pip:

pip install "rdflib==2.4.2"

PyCml itself

PyCml is now included with the main Chaste source code, as source:trunk/python/pycml.

There is a helper script (source:trunk/python/ConvertCellModel.py) to simplify the process of using PyCml. See also ChasteGuides/CodeGenerationFromCellML for more information.

Last modified 6 years ago Last modified on May 22, 2014, 11:28:50 AM