Skip to content

Commit

Permalink
Merge pull request #194 from wkerzendorf/setup/fix_requirements
Browse files Browse the repository at this point in the history
Setup/fix requirements
  • Loading branch information
ssim committed Nov 9, 2014
2 parents 2311c29 + ce1ea38 commit 6188876
Show file tree
Hide file tree
Showing 9 changed files with 273 additions and 87 deletions.
75 changes: 55 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,71 @@ virtualenv:
system_site_packages: true

env:
- COMPILER=gcc CYTHON_VERSION=0.20.1 NUMPY_VERSION=1.8.0 PANDAS_VERSION=0.12 ASTROPY_VERSION=0.3.2 ASTROPY_USE_SYSTEM_PYTEST=1 SETUP_CMD='test' TEST_MODE='normal'
- COMPILER=gcc CYTHON_VERSION=0.20.1 NUMPY_VERSION=1.8.0 PANDAS_VERSION=latest ASTROPY_VERSION=0.3.2 ASTROPY_USE_SYSTEM_PYTEST=1 SETUP_CMD='test' TEST_MODE='normal'
- COMPILER=gcc CYTHON_VERSION=0.20.1 NUMPY_VERSION=1.8.0 PANDAS_VERSION=latest ASTROPY_VERSION=0.3.2 ASTROPY_USE_SYSTEM_PYTEST=1 SETUP_CMD='test --args="--atomic-dataset=$HOME/kurucz_cd23_chianti_H_He.h5"' TEST_MODE='spectrum'
- COMPILER=clang CYTHON_VERSION=0.20.1 NUMPY_VERSION=1.8.0 PANDAS_VERSION=latest ASTROPY_VERSION=0.3.2 ASTROPY_USE_SYSTEM_PYTEST=1 SETUP_CMD='test --args="--atomic-dataset=$HOME/kurucz_cd23_chianti_H_He.h5"' TEST_MODE='spectrum'
global:
- COMPILER=gcc
- CYTHON_VERSION=0.21
- NUMPY_VERSION=1.8
- PANDAS_VERSION=0.12
- ASTROPY_VERSION=0.4
- ASTROPY_USE_SYSTEM_PYTEST=1
- SETUP_CMD='test'
- TEST_MODE='normal'

matrix:
include:
- python: "2.7"
env: PANDAS_VERSION=0.12

- python: "2.7"
env: PANDAS_VERSION=latest

# - python: "2.7"
# env: ASTROPY_VERSION=development

- python: "2.7"
env: COMPILER=gcc SETUP_CMD='test --args="--atomic-dataset=$HOME/kurucz_cd23_chianti_H_He.h5"' TEST_MODE='spectrum'

- python: "2.7"
env: COMPILER=clang SETUP_CMD='test --args="--atomic-dataset=$HOME/kurucz_cd23_chianti_H_He.h5"' TEST_MODE='spectrum'






before_install:
# We do this to make sure we get the dependencies so pip works below
- sudo apt-get update -qq
- sudo apt-get install -qq python-numpy python-pandas python-scipy python-h5py python-sphinx python-yaml cython libatlas-dev liblapack-dev gfortran
- pip install pip --upgrade
- if [[ $COMPILER == 'clang' ]]; then sudo apt-get install -qq clang; fi
- if [[ $TEST_MODE == 'spectrum' ]]; then wget http://moria.astro.utoronto.ca/\~wkerzend/tardis_atomic_databases/kurucz_cd23_chianti_H_He.zip; fi
- if [[ $TEST_MODE == 'spectrum' ]]; then unzip kurucz_cd23_chianti_H_He.zip; fi
- if [[ $TEST_MODE == 'spectrum' ]]; then mv kurucz_cd23_chianti_H_He.h5 $HOME/; fi
# We do this to make sure we get the dependencies so pip works below
- export PYTHONIOENCODING=UTF8
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b
- export PATH=/home/travis/miniconda/bin:$PATH
- conda update --yes conda

- if [[ $COMPILER == 'clang' ]]; then sudo apt-get install -qq clang; fi
- if [[ $TEST_MODE == 'spectrum' ]]; then wget http://moria.astro.utoronto.ca/\~wkerzend/tardis_atomic_databases/kurucz_cd23_chianti_H_He.zip; fi
- if [[ $TEST_MODE == 'spectrum' ]]; then unzip kurucz_cd23_chianti_H_He.zip; fi
- if [[ $TEST_MODE == 'spectrum' ]]; then mv kurucz_cd23_chianti_H_He.h5 $HOME/; fi

install:
- export PYTHONIOENCODING=UTF8 # just in case
- pip install --upgrade "Cython==$CYTHON_VERSION"
- if [[ $PANDAS_VERSION == 'latest' ]]; then pip install -q --upgrade pandas; else pip install -q --upgrade "pandas==$PANDAS_VERSION"; fi
- if [[ $ASTROPY_VERSION == 'development' ]]; then pip -q install git+http://github.com/astropy/astropy.git#egg=astropy; else pip install -q --upgrade "astropy==$ASTROPY_VERSION"; fi
- pip install -q --upgrade pytest==2.5.1
- pip install -q --upgrade pytest-cov
- conda create --yes -n tardis-travis --file pip-requirements python=$TRAVIS_PYTHON_VERSION
- source activate tardis-travis
- if [[ $NUMPY_VERSION == 'latest' ]]; then conda install --yes numpy; else conda install --yes "numpy==$NUMPY_VERSION"; fi
- if [[ $PANDAS_VERSION == 'latest' ]]; then conda install --yes pandas; else conda install --yes "pandas=$PANDAS_VERSION"; fi
- conda install --yes pytables
#- conda install --yes cython
- if [[ $ASTROPY_VERSION == 'development' ]]; then pip install git+https://github.com/astropy/astropy; else conda install --yes "astropy==$ASTROPY_VERSION"; fi
- conda install --yes pytest

- if [[ $SETUP_CMD == 'test --coverage' ]]; then pip install -q coveralls; fi
- if [[ $SETUP_CMD == 'test --coverage' ]]; then pip install -q pytest-cov; fi

script:
- echo $SETUP_CMD
- echo CC=$COMPILER python setup.py $SETUP_CMD
- CC=$COMPILER python setup.py $SETUP_CMD

after_success:
- if [[ $SETUP_CMD == 'test --coverage' ]]; then coveralls; fi
- if [[ $SETUP_CMD == 'test --coverage' ]]; then coveralls; fi

after_failure:
- cat /home/travis/.pip/pip.log
124 changes: 124 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"

config.vm.provision :shell, path: "bootstrap_trusty64.sh"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.

# Enable provisioning with CFEngine. CFEngine Community packages are
# automatically installed. For example, configure the host as a
# policy server and optionally a policy file to run:
#
# config.vm.provision "cfengine" do |cf|
# cf.am_policy_hub = true
# # cf.run_file = "motd.cf"
# end
#
# You can also configure and bootstrap a client to an existing
# policy server:
#
# config.vm.provision "cfengine" do |cf|
# cf.policy_server_address = "10.0.2.15"
# end

# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file default.pp in the manifests_path directory.
#
# config.vm.provision "puppet" do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "default.pp"
# end

# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision "chef_solo" do |chef|
# chef.cookbooks_path = "../my-recipes/cookbooks"
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { mysql_password: "foo" }
# end

# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# The Opscode Platform uses HTTPS. Substitute your organization for
# ORGNAME in the URL and validation key.
#
# If you have your own Chef Server, use the appropriate URL, which may be
# HTTP instead of HTTPS depending on your configuration. Also change the
# validation key to validation.pem.
#
# config.vm.provision "chef_client" do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# chef.validation_key_path = "ORGNAME-validator.pem"
# end
#
# If you're using the Opscode platform, your validator client is
# ORGNAME-validator, replacing ORGNAME with your organization name.
#
# If you have your own Chef Server, the default validation client name is
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
end
8 changes: 8 additions & 0 deletions bootstrap_trusty64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

apt-get update
apt-get install -y python-virtualenv python-numpy python-pandas python-scipy python-h5py python-yaml ipython python-matplotlib cython git
virtualenv --system-site-packages tardis.ve
chmod -R a+rwX tardis.ve
source tardis.ve/bin/activate
pip install -r /vagrant/pip-requirements
95 changes: 53 additions & 42 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,74 @@ TARDIS has the following requirements:

- `Python <http://www.python.org/>`_ 2.7

- `Numpy <http://www.numpy.org/>`_ 1.5 or later
- `Numpy <http://www.numpy.org/>`_ 1.7 or later

- `Scipy <http://www.scipy.org/>`_ 0.10 or later

- `Astropy <http://www.astropy.org/>`_ 0.2.4 or later
- `Astropy <http://www.astropy.org/>`_ 0.4 or later

- `h5py <http://www.h5py.org/>`_ 2.0.0 or later

- `pandas <http://pandas.pydata.org/>`_ 0.12.0 or later

- `pyyaml <http://pyyaml.org/>`_ 3.0 or later

Most of these requirements are easy to install using package managers like OS X's macports or normal linux package managers.
Most of these requirements are easy to install using package managers like
OS X's macports or linux package managers.

TARDIS is using astropy's excellent installation helpers and thus uses similar instructions to astropy.
TARDIS is using astropy's excellent installation helpers and thus uses similar
instructions to astropy.

Installing TARDIS with virtualenvs (recommended)
================================================

Installing TARDIS
=================
We highly recommend installing TARDIS in a virtual environment. A virtual
environment is python's way to ensure that the versions of third-party libraries
that TARDIS requires do not interfere with the system-wide installation. This
is also the way that the majority of core developers for TARDIS operate.

On Ubuntu (13.10)
It is nevertheless recommended to install a number of python packages using the
system packagemanager. This ensures that third-party non-python libraries like
`libhdf5`, `lapack`, etc. are installed.

For OS X we recommend the `macports <http://www.macports.org/install.php>`_ package
manager::

sudo port install python27 py27-scipy py27-numpy py27-virtualenv py27-astropy py27-h5py py27-yaml py27-pandas py27-pip py27-tables

In Ubuntu 14.04 the pre-requesite install works with this::

sudo apt-get install python-virtualenv python-numpy python-pandas python-scipy python-h5py python-yaml ipython python-matplotlib cython git

First use the following guide to install virtualenv and the TARDIS requirements
:doc:`workflow/python_environment`.

After the virtualenv and the requirements are installed, there are a few options
of how to proceed.

If one just wants to use TARDIS you can install the latest stable version::

pip install tardis-sn

the latest development version can be installed using::

pip install git+https://github.com/tardis-sn/tardis

If you are interested in doing some development for TARDIS please read
:doc:`workflow/development_workflow`.


Once you are done you can run the simple example listed in :doc:`running`.



Installing TARDIS system-wide (not recommended)
===============================================

On Ubuntu (14.04)
-----------------

We use a clean install of Ubuntu 13.10 as one of our testing grounds. Here's how we get TARDIS to run::
We use a clean install of Ubuntu 14.04 as one of our testing grounds. Here's how we get TARDIS to run::

sudo apt-get install python-dev python-pip python-numpy python-scipy python-h5py python-pandas python-yaml

Expand All @@ -50,10 +94,7 @@ We now need to install the newest astropy and we will install everything into ou
Once astropy is installed, install TARDIS::

pip install tardis-sn --user --pre

Add a `--pre` to install the latest development version (currently no stable version is available).

pip install tardis-sn

.. note::
pip often tries to take care of many of the dependencies, this might be annoying as they already exist.
Expand Down Expand Up @@ -81,33 +122,3 @@ Before running, ensure that the directory ~/Library/Python/2.7/bin is in the app
This has also been successfully tested on a clean MAC OS 10.9.1 (Mavericks) install.


Building from source
====================

Prerequisites
-------------

You will need a compiler suite and the development headers for Python and
Numpy in order to build TARDIS. On Linux, using the package manager for your
distribution will usually be the easiest route, while on MacOS X you will
need the XCode command line tools.

The `instructions for building Numpy from source
<http://docs.scipy.org/doc/numpy/user/install.html>`_ are also a good
resource for setting up your environment to build Python packages.

You will also need `Cython <http://cython.org/>`_ installed to build
from source.

.. note:: If you are using MacOS X, you will need to the XCode command line
tools. One way to get them is to install `XCode
<https://developer.apple.com/xcode/>`_. If you are using OS X 10.7
(Lion) or later, you must also explicitly install the command line
tools. You can do this by opening the XCode application, going to
**Preferences**, then **Downloads**, and then under **Components**,
click on the Install button to the right of **Command Line Tools**.
Alternatively, on 10.7 (Lion) or later, you do not need to install
XCode, you can download just the command line tools from
https://developer.apple.com/downloads/index.action (requires an Apple
developer account).

2 changes: 1 addition & 1 deletion docs/workflow/development_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Many of the Development workflow is taken from `Astropy <http://docs.astropy.org
/en/stable/development/workflow/development_workflow.html>`_ and credit belongs
to the Astropy team for designing it.

The first step is to setup up a python environemnt. :doc:`python_environment`
The first step is to setup up a python environment. :doc:`python_environment`
explains how to do that.

:doc:`git_workflow` describes how to interact with git and github in the development
Expand Down
Loading

0 comments on commit 6188876

Please sign in to comment.