Skip to content

Running from source

Paul Müller edited this page Dec 22, 2015 · 36 revisions

This article describes how to run PyCorrFit from source using Python. For general installation instructions, see Installation.

You do not need to install Python on your system. Checkout the releases for pre-compiled binaries.

PyCorrFit is in the Python Package Index and can be easily installed via pip.

Alternatively, to run PyCorrFit from source, download the contents of this repository, install the necessary modules (see below), and execute

python setup.py build_ext --inplace

to build the Cython modules. To run PyCorrFit, go to the PyCorrFit directory and execute

python -m pycorrfit

Requirements

Windows

The Anaconda distribution comes with almost all the packages preinstalled. Download and install it. If wxPython is not available, install it via

conda install wxpython

In order to use the Latex-plotting features of PyCorrFit, install MikTex with automatic package download (Install missing packages on-the-fly) from http://www.miktex.org/.

Without Anaconda

You may install Python an the required packagages by hand. This, however might lead to a couple of problems that can be solved like this:

MacOS X

One way to run PyCorrFit from source is to install python via homebrew. The exact commands to make PyCorrFit run on a mac are located in the .travis.yml file at the root of the repository.

The most easy installation is probably via the Anaconda distribution. Beware that you might need to patch the wx.lib.plot module with /freeze_travis/wxPython-3.0.2.0-plot.patch.

Alternatives

There are two other ways to install the dependencies for PyCorrFit. Installing with MacPorts or manually installing Python with the packages listed above (.dmg files) as described here.

The following points make python2.7 the default when executing python.

  • Create a soft link in /Library/Frameworks/Python.framework/Versions/

      cd /Library/Frameworks/Python.framework/Versions/
      sudo ln -s 2.7 Current
    
  • Switch the /usr/bin/python link to point to Python 2.7.

      cd /usr/bin
      sudo rm -f python
      sudo ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/python python
    
  • Download and unpack setuptools from https://pypi.python.org/pypi/setuptools and install with

      sudo python /path/to/ez_setup.py
    
  • Install pip

      sudo easy_install-2.7 pip
    
  • In order to install PyYAML, XCode needs to be installed (A registration with Apple is necessary). For OS 10.6.8, install XCode 3.2 https://developer.apple.com/downloads/index.action#

  • Install sympy and PyYAML

      sudo pip2.7 install sympy pyyaml nose
    
  • Get the sources of PyCorrFit from Releases, by cloning PyCorrFit using Git 1.8.4.2, or by installing PyCorrFit using pip.

  • In order to use the Latex-plotting features of PyCorrFit, install MacTex from http://tug.org/mactex/.

  • Compiling code with PyInstaller did not work with sympy version 0.12.0. I used an older version

      pip install sympy==0.7.3
    

    and had to rename (or remove) the file

      /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sympy/mpmath/libmp/exec_py3.py
    

    that PyInstaller was complaining about.

Debian/Ubuntu (Linux)

This article describes the recommended way to run PyCorrFit from source in a build environment.