ΦFlow Installation


For GPU acceleration, deep learning and optimization, either PyTorch, TensorFlow 2.x or Jax must be registered with your Python installation. Note that these also require a CUDA installation with cuDNN libraries for GPU execution. We recommend CUDA 11.0 with cuDNN 8.

Installing ΦFlow using pip

Note: If you want to use the ΦFlow CUDA operations with TensorFlow, you have to build ΦFlow from source instead (see below).

The following command installs the latest stable version of ΦFlow with GUI support using pip.

$ pip install phiflow dash plotly imageio

To install the latest developer version of ΦFlow, run

$ pip install --upgrade git+

Installing ΦFlow from Source

The ΦFlow source additionally contains demo scripts and tests. In particular, it includes tests/, which tests your configuration.

Clone the git repository by running

$ git clone <target directory>

This will create the folder <target directory> and copy all ΦFlow source files into it.

With this done, you may compile CUDA kernels for better performance, see below.

Finally, ΦFlow needs to be added to the Python path. This can be done in one of multiple ways:

Compiling the CUDA Kernels for TensorFlow

The ΦFlow source includes several custom CUDA kernels to speed up certain operations when using TensorFlow. To use these, you must have a TensorFlow compatible CUDA SDK with cuDNN as well as a compatible C++ compiler installed. We strongly recommend using Linux with GCC 7.3.1 (apt-get install gcc-4.8) for this. See the tested TensorFlow build configurations.

To compile the CUDA kernels for TensorFlow, clone the repository as described above, then run $ python <target directory>/ tf_cuda. This will add the compiled CUDA binaries to the <target directory>.

Verifying the installation

If you have installed ΦFlow from source, execute the included script.

$ python <Φ-Flow directory>/tests/

Otherwise, run the following Python code.

import phi

If ΦFlow and dependencies are installed correctly, you should see the text Installation verified., followed by additional information on the components at the end of the console output.

Unit tests

PyTest is required to run the unit tests. To install it, run $ pip install pytest.

Some unit tests require TensorFlow and PyTorch. Make sure, both are installed before running the tests.

Execute $ pytest <target directory>/tests/commit to run the normal tests. The result of this should match the automated tests run by Travis CI which are linked on the main GitHub page.

You can run the additional tests

$ pytest <target directory>/tests/gpu
$ pytest <target directory>/tests/release