ewan-klein / carneades

http://ewan-klein.github.io/carneades/
Apache License 2.0
7 stars 11 forks source link

Carneades sample code

This is a pedagogically-oriented attempt to implement aspects of the Carneades Argument Evaluation framework. It closely follows the Haskell implementation in the CarneadesDSL package.

The libraries needed to run this code on DICE are already available (except that the plotting functionality is currently not supported). Just remember that you need to explicitly call python3.4 since the python command on DICE defaults to python2.7. So if you are happy to work on DICE, you are ready to go. :smile:

If you want to install the necessary libraries on your own machine, however, read on.

Installing the libraries for the Carneades sample code on your own computer

Requirements

Installation

Install python3.4 (via apt, homebrew or your favourite package_system)

Note for Linux users (especially Ubuntu 12.04 users): follow this link to have more info about installing the python distro.

Create a virtualenv:

$ virtualenv -p python3.4 envname
$ source /envname/bin/activate

Install sphinx and basicstrap

$ pip install sphinx
$ pip install sphinxjp.themes.basicstrap

Install igraph

$ pip install python-igraph

This should also install the C bindings. If that doesn't happen because of some error, it's likely to be one of the following problems:

# in a new terminal:
$ sudo apt-get install python-dev python3.4-dev
$ sudo apt-get install build-essential
$ sudo apt-get install libxml2-dev
# download the igraph c bindings and extract.
$ wget http://igraph.org/nightly/get/c/igraph-0.7.1.tar.gz
$ tar xvf igraph-0.7.1.tar.gz
$ cd igraph-0.7.1

# Installation
$ ./configure
$ make
$ make install
$ sudo ldconfig # this does some magic!

Install pycairo

On Ubuntu, check this package.
By default this will install the package into python (which may not be python3.4)
(TODO: will this still work??))

If you are using a virtualenv or you don't use Ubuntu, do the following:

$ wget https://www.cairographics.org/releases/pycairo-1.10.0.tar.bz2
$ bunzip2 pycairo-1.10.0.tar.bz2
$ tar xvf pycairo-1.10.0.tar
$ cd pycairo-1.10.0/
$ ./waf configure # This will fail, but need to generate the hidden .waf folder first for below
$ ./waf configure --prefix=$VIRTUAL_ENV
$ ./waf build
$ ./waf install

Download and Install pixman

# Open a new terminal and run these commands:
$ wget https://www.cairographics.org/releases/pixman-0.34.0.tar.gz
$ tar xvf pixman-0.34.0.tar.gz
$ cd pixman-0.34.0

# configure make install:
$ ./configure
$ make
$ make install

Download and Install cairo

# continuing from above:
$ cd ..
$ wget https://www.cairographics.org/releases/cairo-1.14.6.tar.xz
$ tar xvf cairo-1.14.6.tar.xz
$ cd cairo-1.14.6

# configure make install:
$ ./configure
$ make
$ make install

You should now have both cairo and pixman installed in your machine. Return to installation for pycairolink.

Clone repository

$ git clone https://github.com/ewan-klein/carneades.git
$ cd carneades

Generate the documentation

$ cd doc
$ make html

Test the software

$ cd ../src/carneades # relative root is carneades/
$ python -i caes.py

Install python3.4

(Linux users)

The following is to install python3.4 on Ubuntu 12.04 LTS. Other distributions should do more or less the same. If you have a newer installation of Ubuntu or derivatives, you can probably skip some passages.

WARNING: Although unlikely, this might break your python2 installation, so do it at your own risk or set up a VM

Unless you want to build from source (In which case, kudos!), add this PPA to your apt source list:

$ add-apt-repository ppa:fkrull/deadsnakes
$ apt-get update

then run:

$ apt-get install python3.4 python3.4-dev

Now follow the rest of the installation.