Skip to content

Installation

alexblaessle edited this page Aug 14, 2017 · 20 revisions

Installation

Obtaining Python

PyFRAP is written in Python2.7. If you do not have a running Python installation yet, we highly recommend using Ananconda. Anaconda is a Python distribution, bringing almost all packages that PyFRAP needs to run ( PyQT, numpy, scipy , matplotlib , colorama ) in its default installation. Installation instructions on how to install all remaining necessary packages can be found here . Anaconda can be downloaded for all three major OSs here.

Obtaining PyFRAP

If you have git installed, you can download PyFRAP via:

git clone https://github.com/alexblaessle/PyFRAP

You can also download PyFRAP using this link (You will need to unzip the file).


Installing PyFRAP (short version)

We provide an installation script for PyFRAP for each of the three major operating systems (OSX, Windows, Linux). This section describes how to install PyFRAP using these scripts. This assumes that your computer does not have any specific python installations running. Moreover, it will automatically download Fiji and Gmsh. Note that the installation can take a while depending on the download speed of Gmsh and Fiji.

Linux

This describes how to install PyFRAP on Debian-based operating systems such as Ubuntu. Linux generally already comes with a Python installation so it is not necessary to install Anaconda. The following instructions only work with a native Python installation.

  1. Download PyFRAP as described here.
  2. Open a terminal and navigate to the folder containing PyFRAP.
  3. Type
sudo ./install_linux.sh
  1. Type
./runPyFRAP.sh

OSX

Even though OSX comes with a Python installation, we highly recommend using Anaconda instead. The following instructions only work with Anaconda.

  1. Install Anaconda as described here.
  2. Download PyFRAP as described here.
  3. In Finder, navigate to your PyFRAP folder.
  4. Double-click on install_osx.command (you might need to press Control meanwhile, see here).
  5. Run PyFRAP by double-clicking runPyFRAP.command (you might need to press Control meanwhile, see here).

Windows

  1. Install Anaconda as described here (in the Advanced Installation Options, check the Add Anaconda to my PATH environment variable option).
  2. Download PyFRAP as described here.
  3. In explorer, navigate to your PyFRAP folder.
  4. Double-click on install_win.bat.
  5. Add gmsh to your PATH:
    • In explorer, right click on This PC and select Properties.
    • Click on Advanced system settings.
    • Click on Environment Variables.
    • Click on the upper Edit button.
    • Append the ;FolderContainingPyFRAP\pyfrp\executables\gmsh.
    • Click Apply.
  6. Run PyFRAP by double-clicking runPyFRAP.bat.
  7. Go to settings and adjust the path to gmsh (FolderContainingPyFRAP\pyfrp\executables\gmsh\gmsh.exe).
  8. Go to settings and adjust the path to Fiji (FolderContainingPyFRAP\pyfrp\executables\gmsh\gmsh.exe).

Installing PyFRAP (long version)

If you have setuptools installed, you can install PyFRAP via:

python setup.py install --user

We highly recommend installing with the --user option, since PyFRAP needs to read/write data files in the installation folder. In some cases, this might lead to file permission issues.

Installing external packages automatically

PyFRAP installation can automatically download and install Gmsh and Fiji when executing setup.py and automatically link the two executables with PyFRAP. For this to work, you need to install wget. To install wget, type

pip install wget

or if you use the Ananconda distribution

conda install pywget

Obtaining Gmsh

PyFRAP relies heavily on Gmsh for its generation of finite element meshes that are used for PDE simulations. If you want Gmsh to be installed automatically, expand your installation command by the --gmsh flag:

python setup.py install --user --gmsh

Obtaining Fiji

Fiji is a image processing package wrapping ImageJ with tons of useful plugins and scripts. PyFRAP uses it mostly to handle microscope image formats. If you want Fiji to be installed with PyFRAP automatically, expand your installation command by the --gmsh flag:

python setup.py install --user --fiji

Want to know more?

If you are interested about details of the setup.py and want to learn more about all the options, check out the PyFRAP setup.py API .

Manual installation of packages in custom build

PyFRAP relies on a bunch of non-standard python packages. Here we describe how to install them for all three major OSs.

Linux

Generally, all Linux distributions come with a proper installation of Python2.7, so installing it will not be required. If you are using a Debian-based Linux distribution such as Ubuntu, most of the packages that PyFRAP requires are in the package manager. So to install them, type (you will need sudo rights):

sudo apt-get install python-numpy
sudo apt-get install python-scipy
sudo apt-get install python-matplotlib
sudo apt-get install python-qt4
sudo apt-get install python-skimage
sudo apt-get install python-vtk

Installation instruction for all remaining packages can be found here.

OSX

Even though OSX comes with a native Python2.7 installation, we do not recommend using it. Either use Anaconda , see here , or homebrew, a great package manager for OSX. A good installation guide for Python via homebrew can be found here.

Having installed homebrew and Python, check if you installed Python properly (that means that you added your new Python to PATH and restarted your terminal) by typing

which python

Your output should be

/usr/local/bin/python

Now we can install all other packages using either homebrew or pip.

PyQT

For PyFRAP's GUI, download and install PyQT4 and SIP by typing into the Terminal

brew install sip
brew install pyqt
brew linkapps

Numpy / Scipy

Numpy is the main numerical python library. Download and install it by typing into the Terminal

pip install cython
pip install nose
brew install numpy 
brew link numpy

Sometimes NumPy can also be found by typing into the Terminal

brew install homebrew/python/numpy
brew link numpy

Download and install SciPy by typing into the Terminal

pip install scipy

or

brew install scipy

Matplotlib

Download and install Matplotlib by typing into the Terminal

pip install python-dateutil
pip install pyparsing 
brew install matplotlib

Pysparse

For a better performance during the FRAP simulations we recommend using the pysparse package. Currently it seems that this package is corrupted in pip (might change in the next update), so building it from source is necessary. To do so, go here and download the latest version of pysparse. Unpack the downloaded file and go to the folder containing the unpacked files by typing

cd path/to/unpacked_files

Build the pyparse package by typing python setup.py install

Installation instructions for all additionally necessary packages can be found here

Vtk

If you are using Anaconda, you should look here. If not, use

brew install --with-python --with-qt vtk7

Windows

Windows is not shipped with any version of Python2.7. Hence you must install it either using Anaconda (recommended), or install Python and all packages manually. Most of the packages come with installers, however some packages might need some powershell commands. Here we guide you through the most basic steps:

Python

Download and install the current version of Python 2.7x.

PyQT

Download and install the current version of PyQt4. The Windows installer will also install the required package SIP an all necessary QT libraries.

Scipy-stack

Download and install the current version of scipy-stack. scipy-stack includes important Python packages such as nose, numpy, scipy and matplotlib. If you want to install the packages separately because there is no suitable installation binary of scipy-stack available, you can use the following links. However, we recommend using scipy-stack:

All packages on http://www.lfd.uci.edu/~gohlke/pythonlibs are provided as wheel (.whl) format. To install a wheel package, type

pip install wheelpackage . whl

Scikit-image

Download and install the current version of scikit-image.

Pysparse

Pysparse is a Python wrapper for solvers of sparse matrices. Download it and install the current version
of pyparse. In case of a 64bit system, there is a mistake in the file pysparse package that is easy to fix. The code of the function addAt in the file pysparseMatrix.py needs to be changes to:

	def addAt(self, vector, id1, id2):
		import numpy as np
		id1=id1.astype(np.int32)
		id2=id2.astype(np.int32)
    
		self.matrix.update_add_at(vector, id1, id2) 

Vtk

Download and install the current version of vtk.

Manual installation of necessary packages

FiPy

FiPy is a Python based PDE simulation toolbox. FiPy can be found in the Python Package index ( pip ) and thus installed via

pip install fipy

Scikit image

Scikit image is a image manipulation library based on scipy. PyFRAP uses it to load image data and apply denoising and smoothening filters. It can be installed via

pip install -U scikit-image

meshio

meshio is a neat little package being able to convert between mesh formats. PyFRAP uses it to convert Gmsh files into .vtk files for mesh plots. It can be installed via

pip install meshio

vtk

vtk is a visualization toolkit used by PyFRAP to draw meshes. If you are using Anaconda, type

conda install -c https://conda.anaconda.org/anaconda vtk

If you are not using Anaconda, look to the OS specific installation instructions on how to install vtk.