This code is distributed under the LGPL 2.1 license.
Python 2.7 (does not work with Python 3)
- JDK 1.7+
A pre-installed py-causal Docker image is available at Docker Hub
To install on existing Python installation, we have found two approaches to be useful: Direct python installation with pip, possibly including use of Jupyter. This approach is likely best for users who have Python installed and are familiar with installing Python modules. Installation via Anaconda, which installs Python and related utilities.
Directions for both approaches are given below...
Installation with pip
If you do not have pip installed already, try these instructions.
Once pip is installed, execute these commands
pip install numpy pip install pandas pip install javabridge pip install pydot pip install GraphViz
Note: you also need to install the GraphViz engine by following these instructions.
We have observed that on some OS X installations, pydot may provide the following response Couldn't import dot_parser, loading of dot files will not be possible.
If you see this, try the following
pip uninstall pydot pip install pyparsing==1.5.7 pip install pydot
Then, from within the py-causal directory, run the following command:
python setup.py install
After running this command, enter a python shell and attempt the follwing import import pandas as pd import pydot from tetrad import search as s
Finally, try to run the python example
Be sure to run this from within the py-causal directory.
This program will create a file named tetrad.svg, which should be viewable in any SVG capable program. If you see a causal graph, everything is working correctly.
We have found Jupyter notebooks to be helpful. (Those who have run IPython in the past should know that Jupyter is simply a new name for IPython). To add Jupyter to your completed python install, simply run
pip -U jupyter jupyter notebook
and then load one of the Jupyter notebooks found in this installation.
Installing Python with Anaconda and Jupyter may be easier for some users:
- Download and install Anaconda
- conda install python-javabridge
For OS X, this default install does not seem to work well. try the following instead:
conda install --channel https://conda.anaconda.org/david_baddeley python-javabridge
Then run the following to configure anacoda
conda install pandas conda install numpy conda install pydot conda install graphviz conda install -c https://conda.anaconda.org/chirayu pycausal jupyter notebook
and then load one of the Jupyter notebooks.