Installation
============


Requirements
----------------------------------------


For the default XML serialization (saving NeuroML to XML files), only *lxml* is required:

::

    sudo pip install lxml

Alternatively, on Linux you can use:

::

    sudo apt-get install python-lxml

To use the other serializations (e.g. HDF5, JSON, see `Vella et al. 2014 <http://journal.frontiersin.org/Journal/10.3389/fninf.2014.00038/abstract>`_) 
the following will also be required:

::

    sudo apt-get install libhdf5-serial-dev
    sudo pip install numpy
    sudo pip install numexpr
    sudo pip install jsonpickle
    sudo pip install pymongo
    sudo pip install simplejson
    sudo pip install tables

See `.travis.yml <https://github.com/NeuralEnsemble/libNeuroML/blob/master/.travis.yml>`_ for the latest requirements on libraries etc.

Install libNeuroML via pip
----------------------------------------

::

    pip install libNeuroML

This is always the latest stable branch from GitHub, and installs the minimal requirements (``lxml``).

To install all of requirements to include the other serialisations, use

::

    sudo apt-get install libhdf5-dev
    pip install libNeuroML[full]

The ``apt`` line is required at time of writing because PyTables' wheels for python 3.7 depend on the system libhdf5.




Install using a local copy of libNeuroML source
-----------------------------------------------

Install `git`_ and type:

::

    git clone git://github.com/NeuralEnsemble/libNeuroML.git
    cd libNeuroML


More details about the git repository and making your own branch/fork are `here <how_to_contribute.html>`_.


.. _Git: http://rogerdudler.github.com/git-guide/


Use the standard install method for Python packages:


::

    sudo python setup.py install

To use the **latest development version of libNeuroML**, switch to the development branch:


::

    git checkout development
    sudo python setup.py install


Run an example
--------------

Some sample scripts are included in `neuroml/examples`, e.g. :

::

     cd neuroml/examples
     python build_network.py

The standard examples can also be found `here <examples.html>`_

Unit tests
----------

To run unit tests cd to the directory '/neuoroml/test' and use the python unittest module discover method:

::

    python -m unittest discover

If everything worked your output should look something like this:

::

    .......
    ----------------------------------------------------------------------
    Ran 55 tests in 40.1s
    
    OK

Alternatively install and use pytest:

::

    pytest -v --strict -W all


To ignore some tests, like the mongodb test which requres a mongodb setup, run:

::

    pytest -v -k "not mongodb" --strict -W all
