-
Notifications
You must be signed in to change notification settings - Fork 8
InstallationAdvanced
Here we describe how to install PyFRAP for custom installations for the three major operating systems
* [Linux](#Linux)
* [OSX](#OSX)
* [Windows](#Windows)
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-qt4
sudo apt-get install python-vtk
sudo apt-get install default-jdk
sudo apt-get install default-jre
The PDE solver FiPy needs some packages to be installed prior to installation to run some tests, so we install matplotlib first via
pip install matplotlib
You can then install PyFRAP using
pip install pyfrp
This installation will automatically download Gmsh and link it to your PyFRAP installation.
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.
For PyFRAP's GUI, download and install PyQT4 and SIP by typing into the Terminal
brew install sip
brew install pyqt
brew linkapps
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
Download and install Matplotlib by typing into the Terminal
pip install python-dateutil
pip install pyparsing
brew install matplotlib
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
If you are using Anaconda, you should look here. If not, use
brew install --with-python --with-qt vtk7
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:
Download and install the current version of Python 2.7x.
Download and install the current version of PyQt4. The Windows installer will also install the required package SIP an all necessary QT libraries.
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
Download and install the current version of scikit-image.
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)
Download and install the current version of vtk.
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 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 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 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.
It is good practice to use virtual environments to not temper with the system-wide python installation. A good guide on how to setup a virtualenv can be found here. We will use a simple virtualenv setup to install PyFRAP. Since setting up PyFRAP up in a virtualenv needs some OS-specific preparations, we lead you through the setup for each OS speparately.
PyFRAP relies on a few packages that cannot be installed in a virtualenv, such as PyQT4 and vtk. To install these packages system-wide, type
sudo apt-get install python-qt4
sudo apt-get install python-vtk
Moreover, PyFRAP uses python-bioformats to read microscope image data. This package is a wrapper of the OME bioformats package written in Java and thus needs a javabridge to run. This requires a working java installation. If you already have a version of Java/JRE installed, ignore the following commands. Otherwise, type
sudo apt-get install default-jdk
sudo apt-get install default-jre
to install the default Java/JRE version on your system.
You can now switch to your virtualenv via
source your_project/bin/activate
We now need to link the installation of PyQT4 and vtk to your virtualenv. via
pip install vext.vtk
pip install vext.pyqt4
Now, we install
pip install matplotlib
pip install pyfrp
PyFRAP should be running now.
PyFRAP uses python-bioformats to read microscope image data. This package is a wrapper of the OME bioformats package written in Java and thus needs a javabridge to run. This requires a working java installation. If you already have a version of Java/JRE installed, ignore the following instructions. Go here to download and install the Java Development Kit (JDK). Compiling javabridge also requires the Microsoft Visual C++ Compiler for Python 2.7. You can download and install it from here.
You can now switch to your virtualenv via
your_project/Scripts/activate
The installation of the current version (0.13.0) of scikit-image fails due to a missing header file. We thus need to install the previous version via
pip install scikit-image==0.12.0
Now, we install
pip install matplotlib
pip install pyfrp
PyFRAP should be running now.
Here we explain how to install PyFRAP manually using setuptools.
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.
PyFRAP relies heavily on Gmsh for its generation of finite volume meshes that are used for PDE simulations. If you install PyFRAP using pip or setuptools, Gmsh is installed automatically. If you have your own installation of Gmsh running and do not want PyFRAP to install Gmsh, expand your installation command by the --noGmsh flag:
python setup.py install --user --noGmsh
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 .