Skip to content

Setting up a development environment

Jens Jap edited this page Apr 6, 2016 · 39 revisions

These are instructions for setting up a development environment for OpenMeta-Analyst (OpenMeta for short). We include platform-specific advice where relevant. Installation on *nix platforms should be similar to OS X.

OpenMeta is written in Python & R. For the former, we are using Python 2.7.5. For R, we now use R 3.0.1.

Mac

Recommended method: (Macports)

Now install, all the necessary ports. Make sure the version of R is compatible (3.0.X)

> port install py27-pyqt4 R py27-pip py27-cx_Freeze

Make sure to set correct python path.... ie

> sudo port select --set python python27

Then, install rpy2 NOT through macports.

> pip-2.7 install rpy2

Now follow the instructions in the Readme to install the required R packages.

Your environment should now be ready. We don't recommend using virtualenv as it has led to problems when trying to make builds for distribution.

Non-MacPorts method:

For making app builds:

Linux

NOTE: INCOMPLETE INSTRUCTIONS. But setting up on linux is the easiest of all, you get everything you need from apt repositories and it all works out of the box.

On Ubuntu sudo apt-get install r-base-core python-rpy2 python-qt4

Windows

  1. Python: On Windows, we recommend installing the binary distribution of Python 2.7, which can be retrieved here.

  2. Also install pywin32 from http://sourceforge.net/projects/pywin32/. There is a link to it from the python.org site above.

  3. Get R from http://cran.us.r-project.org/. We are using the 64bit version.

  4. We also need Rtools from the same site (cran) in order to build packages.

  5. You need to set some environment variables for rpy2 to work correctly:

    • set R_HOME environment variable to: C:\Program Files\R\R-3.0.1
    • set R_USER to: george or byron or tom or chris or issa or whatever your name is
  6. rpy2. We have had problems trying to install via pip or from source. We even had to install visual studio to try to solve some problem due to a missing vcvarsall.bat (problem was not solved). Luckily there is this site where you download an unofficial binary installer which is a godsend. http://www.lfd.uci.edu/~gohlke/pythonlibs/ <-- install unofficial rpy2 binary for rpy2 2.3.6 Test your rpy2 installation by starting up a python console and typing:

> import rpy2  
> from rpy2 import robjects as ro  
> ro.r("2+2")  

You should get 4.

  1. We use PyQt4 for our GUI library. Windows users can just grab the binary (here) and install it. We are currently using this one: PyQt4-4.10.1-gpl-Py2.7-Qt4.8.4-x64.exe

  2. Get the necessary R packages as described below or in the Readme.

  3. Install py2exe to make windows builds

  4. Add C:\Program Files\R\R-3.0.1\bin\x64 to PATH environment variable

  5. Copy the 64 bit version of MSVCP90.dll fromsomewhere on the machine (it will probably be there) to C:\Python27\DLLs. If you don't have it, you can get it from here. Or you can search for it after installing Microsoft Visual C++ Runtime Components

  6. To allow the bundled Qt to display pixmaps, copy C:\Python27\Lib\site-packages\PyQt4\plugins\imageformats to the directory where the executable was built (probably src\dist)

R dependencies

-- The aim here is to install dependencies sufficient to build and install the openmetar package, which can be found under the R directory in the repo. There is an "install.r" script that should do most of this for you:

source("install.r") within R.

If you'd rather install dependencies manually, openmetar depends on the following packages:

  • metafor
  • lme4
  • igraph
  • MCMCpack
  • HSROC (SEE NOTE)

Do the following instead of using the install script:

Install the following additional dependencies first.

> source("http://bioconductor.org/biocLite.R")
> biocLite("graph")
> biocLite("Rgraphviz")

Then run from within a sudo-ed R:

> install.packages(c("metafor","lme4","MCMCpack","igraph"))
> install.packages(c("ape","mice","Hmisc"))

Note: The HSROC package used should be the one found in the OpenMetaAnalyst/R directory, not the one from CRAN. The version in OpenMetaAnalyst/R has been modified.

Then install the custom R packages from the src/R folder by executing the following commands:

> R CMD build HSROC
> R CMD build openmetar
> sudo R CMD INSTALL HSROC_2.0.5.tar.gz
> sudo R CMD INSTALL openmetar_1.0.tar.gz

Note: on Ubuntu, mcmcpack and lme4 are also available from APT: sudo apt-get install r-cran-mcmcpack r-cran-lme4