PyFEM Installation Guide

PyFEM can be installed directly from the GitHub source. Both the Python API and the command-line interface (CLI) are included.

Requirements

  • Python 3.9 or newer

  • pip (Python package manager)

  • (Optional but recommended) a virtual environment:

python3 -m venv .venv
source .venv/bin/activate    # Linux / macOS
.venv\Scripts\activate       # Windows PowerShell

Installation Steps

  1. Clone the repository

    git clone https://github.com/jjcremmers/PyFEM.git
    cd PyFEM
    
  2. Install with pip

    pip install .
    

    For developers who want to make local changes and test immediately, install in editable mode:

    pip install -e .
    

Verifying the Installation

After installation, verify that both the CLI (the Command Line Interface, the actual exectuable) and the API (the Application Programming interface) are available.

CLI usage

Run one of the example input files.

cd examples
cd ch02
pyfem PatchTest4.pro

API usage

from pyfem import run

output = run("inputfile.pro")

If both commands run without errors, the installation is successful.

Updating PyFEM

To update to the latest version from GitHub:

cd PyFEM
git pull origin main
pip install --upgrade .

OLD

Below, instructions are given how to access PyFEM and install it on windows using Git Bash.

The original code can be downloaded from the website that accompanies the book.

The latest development version is available on Github:

This version of the PyFEM is written to work properly in combination with Python version 3.x. In addition, the code uses the modules numpy, scipy and matplotlib. Installation guidelines are given for various operating systems.

Linux

The Python compiler and the modules numpy, scipy, and matplotlib are included in most common distributions of Linux and can be installed without any problems. In many cases, different versions of python are offered. Please make sure that python version 3.6 or higher is installed. In addition, the modules meshio, pickle, and h5py can be installed for additional functionality.

Execute the file install.py in the root directory pyfem. In a terminal, one can type:

./install

This script will check if the correct versions of Python and the various modules are available. If not, it will ask your permission to install the correct modules for you.

The main executables are created. In commandline you can run PyFEM by typing

The Graphical User Interface of the code (currently under development) can be exectuted by typing from any directory:

It is advised to create aliases. When using a bash shell, please add the following lines to the file ~/.bashrc:

You can then run PyFEM in commandline from any directory by typing:

You can start the gui by typing:

Windows

Under construction

MacOS

Under construction