_   _   ___
               | | | | /   |
  __ _ _ __ ___| |_| |/ /| |_ __  _   _
 / _` | '__/ _ \ __| / /_| | '_ \| | | |
| (_| | | |  __/ |_| \___  | |_) | |_| |
 \__, |_|  \___|\__|_|   |_/ .__/ \__, |
  __/ |                    | |     __/ |
 |___/                     |_|    |___/

gretl4py is a Python package designed to meet the needs of econometricians and applied economists who wish to use Python in their research. It can be broadly viewed as a complement to the statsmodels package, with a more specific orientation toward the inference methods commonly employed in applied economics.

gretl4py provides an interface to libgretl for the Python language (versions 3.11, 3.12, 3.13 and 3.14 have been tested). Libgretl is the underlying engine for the gretl program. At present, gretl4py provides interfaces to all native estimators, several specified functions (like times-series filtering), and gretl packages (including addons). What's more, gretl4py can now deal with gretl bundles.

gretl4py consists of the following elements:

Source code (git repository): source, official PyPI page: gretl4py.

Install

Gretl4py is distributed via PyPI infrastructure, so all you need to do is to call: python(.exe) -m pip install gretl4py.

Linux users may encounter security warnings when installing non-system Python packages. This affects distributions such as Debian/Ubuntu and Arch. To comply with these restrictions, you can run the webinstall.py script available here. This script downloads a wheel package from the SourceForge website and installs it locally.

Building

Instructions can be found in section 2.3 of the gretl4py documentation. Besides a C++ compiler with support for the C++17 standard, you'll need the following development packages for gretl 2025b or later:

Note that we are using the Meson build system.

Running gretl4py

You can find numerous sample *.py files in the demo and examples subdirectories of gretl4py. These files can be examined in any suitable text editor. Starting from the gretl4py directory, one way to explore the package is:

cd demo
python3 estimators.py

(Substitute python.exe for python3 on Windows.) You can also run gretl4py interactively. Start the Python interpreter and type import gretl. In addition to regular Python commands, you can call any of the functions described in the gretl4py documentation.

Documentation

The PDF documentation contains many more details about the gretl4py module, including a listing of the available APIs and several usage examples.

Marcin Błażejowski, marcin(at)gretlconference(dot)org

Last updated: 2025-10-22