Some use cases require an OpenFisca installation in a local environment where some tools should be pre-installed. First establish if the use case requires installation via the getting started page.
OpenFisca runs with Python.
If the local environment already has an appropriate Python
version (with pip
) then this step can be skipped. Check the OpenFisca country package for supported Python versions.
All country templates depend on the OpenFisca Core package, at the time of writing, OpenFisca Core supports python versions 3.9 -> 3.11.
To check the pip
installation run this command in the local terminal:
pip --version
If this results in pip: command not found
, then installing Python is required.
Python
installation is required to run OpenFisca code on a local environment. The Python
version required depends on the OpenFisca country package to be installed.
These instructions apply to the OpenFisca-Country-Template
by way of example, other country packages have a similar structure.
To identify the Python revision of the OpenFisca-Country-Template
:
Check the pyproject.toml* of the OpenFisca-Country-Template repository,
Check the classifiers
values where the Python version is described by a value like "Programming Language :: Python :: 3.11"
(here 3.11
)
When multiple Python versions are listed, it is advised to install the most recent version (3.11 for example if 3.9, 3.10 and 3.11 are listed).
* In some older versions of country packages the information will instead be in the setup.py
file at the root of the project.
Python installation depends on the operating system.
Follow the default installation instructions in the Python official documentation. Find the appropriate version required before proceeding to install.
Docker users might find it easier to follow a different installation for Python and rely on Python official image instead. See the Install with Docker page.
Microsoft Windows users can also utilise the conda package and environment manager to install the OpenFisca-Country-Template published on PyPi or one of the OpenFisca packages published on PyPi.
OpenFisca-Country-Template is also published as conda package but the available openfisca packages list is shorter.
To install Python through conda:
install the Anaconda distribution for Python, pip and conda.
or, also consider the minimal Miniconda distribution for Python, pip and conda.
Source code is managed with the Git version control system. If the use-case includes contributing to the rules, Git
is going to be an essential requirement.
To can check for a valid Git installation run this command:
git --version
It should return the version of Git if Git is installed. If Git isn’t installed, follow the official documentation to install Git for the latest version.
It is recommended to contact those maintaining the relevant package to gain appropriate access first.
Accessing the source code with git should be done via SSH. Using the OpenFisca Country Template as an example the following command demonstrates how that is achieved:
git clone git@github.com:openfisca/country-template.git
If new to SSH, follow these Github instructions on setting up SSH specific to Github.
Note: accessing via HTTPS is not recommended.