Skip to content

Installation

alexblaessle edited this page Sep 22, 2017 · 20 revisions

Installation

Here we explain how to install PyFRAP and all required software. For PyFRAP to run, you need the following ingredients:

  1. A Python (Version 2.7) installation with all required packages installed
  2. Gmsh
  3. Fiji
  4. PyFRAP

PyFRAP can be installed in multiple ways depending on the user's needs. Here we provide two ways of installing PyFRAP for all three major operation systems (Windows, OSX, Linux):

  • A quick and easy installation guide using installation scripts and the Anaconda Python distribution. These instructions are aimed at users with little knowledge about Python and command line terminals. Using this guide you will automatically have installed all 4 previously mentioned ingredients to run PyFRAP.
  • A detailed description on how to install all packages manually. These instructions are suitable for users who are familiar with Python and probably already have a working Python installation running.

In general we recommend using PyFRAP with Ubuntu Linux, since PyFRAP proves to be the easiest to install and use under this OS.


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. Also note that to make use of some of PyFRAP's meshing functionalities, you need to install and link openscad. For Linux users, openscad already gets installed using the following script.

It is important to execute the following steps exactly as described to guarentee a working PyFRAP installation.

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 (Python version 2.7) as described here.
  2. Download and unzip PyFRAP to your computer.
  3. In Finder, navigate to your PyFRAP folder.
  4. Double-click on install_osx.command (you might need to press Control meanwhile, or allow apps from anywhere, see here).
  5. Run PyFRAP by double-clicking runPyFRAP.command (you might need to press Control meanwhile, or allow apps from anywhere, see here).
  6. You can now run PyFRAP and analyze FRAP experiments. A tutorial on how to use PyFRAP's GUI to do so can be found here

Optional: If you want to use some of PyFRAP's more complicated meshing options, you will need to install openscad.

  1. Download and install openscad from here.
  2. In PyFRAP, go to settings and adjust the path (FolderContainingPyFRAP\pyfrp\executables\openscad\openscad.app).

Windows

  1. Install Anaconda (Python version 2.7) as described here (in the Advanced Installation Options, check the Add Anaconda to my PATH environment variable option).
  2. Download and unzip PyFRAP to your computer.
  3. In explorer, navigate to your PyFRAP folder.
  4. Double-click on install_win.bat.
  5. Copy gmsh to your Anaconda Scripts folder
    • Find your Anaconda installation directory (You can use the Windows find function and search for python.exe. Most of the time it is located in C:\Users\YourUserName\AppData\Local\Continuum\Anaconda)
    • At the same time, in your PyFRAP installation directory, navigate to *FolderContainingPyFRAP\pyfrp\executables\gmsh* (where FolderContainingPyFRAP is your PyFRAP installation directory).
    • Copy gmsh.exe to the Scripts folder in the Anaconda installation folder.
  6. 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 (where FolderContainingPyFRAP is your PyFRAP installation directory).
    • Click OK and then Apply.
  7. Run PyFRAP by double-clicking runPyFRAP.bat.
  8. Go to settings and adjust the path to gmsh.
    • In PyFRAP, go to Settings -> Set Gmsh Path -> Change
    • Select gmsh.exe which should be located in FolderContainingPyFRAP\pyfrp\executables\gmsh\gmsh.exe
    • Click Done
  9. Go to settings and adjust the path to Fiji.
    • In PyFRAP, go to Settings -> Set Fiji Path -> Change
    • Select ImageJ.exe which should be located in FolderContainingPyFRAP\pyfrp\executables\Fiji\ImageJ.exe
    • Click Done

Optional: If you want to use some of PyFRAP's more complicated meshing options, you will need to install openscad.

  1. Download and install openscad from here.
  2. In PyFRAP, go to settings and adjust the path (FolderContainingPyFRAP\pyfrp\executables\openscad\openscad.exe).

Obtaining Anaconda

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. 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 (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.