Install Lfortran

Lfortran is a unique Fortran compiler in that it is:

  • Interactive (or compiles as usual from command line)
  • works with Jupyter notebook
  • targets modern Fortran
  • loads module files from other compilers

Quite a unique feature set, but still quite experimental.


This method is for installing Lfortran from the Git repo in Linux / Windows Subsystem for Linux. It assumes Anaconda / Miniconda Python.

  1. install Java JRE sh apt install default-java
  2. install Antler

    mkdir ~/ext
    cd ~/ext
    curl -O
  3. setup Python for Lfortran

    conda create -n lfortran python=3.7 pytest llvmlite prompt_toolkit
    conda activate lfortran
    pip install antlr4-python3-runtime
  4. add Antlr to path:

    export CLASSPATH="$HOME/ext/antlr-4.7.2-complete.jar:$CLASSPATH"
  5. clone Lfortran repo

    cd ~
    git clone
    cd lfortran
  6. complete Lfortran install


Run the selftest