applied-econometrics-2024/README.md

118 lines
2.9 KiB
Markdown
Raw Normal View History

2024-12-29 14:40:51 +01:00
# applied-econometrics-2024
2024-12-29 18:42:48 +01:00
Assignment for Applied Econometrics
# Installation
This project requires reasonable recent versions of
- numpy
- pandas
- matplotlib
- spyder
## OS specific notes
Instructions are added for Mac and Ubuntu based linux. For windows use the Ubuntu based WSL2.
### Windows
To enable WSL2 and install Ubuntu see [Microsoft Learn Article for WSL2](https://learn.microsoft.com/en-us/windows/wsl/install).
In summary running the following as *Administrator* in a shell should enable WSL2 and install Ubuntu:
``` shell
$ wsl --install
```
### Ubuntu
2024-12-30 00:43:19 +01:00
## Anaconda
2024-12-29 18:42:48 +01:00
This is probably the best solution for Windows based environments, however be careful that there are no conflicts with other installed python environments, notably the one _automagically_ installed from the Microsoft Store.
2024-12-30 00:43:19 +01:00
## Poetry (Optional)
2024-12-29 18:42:48 +01:00
Poetry enables sane package management for python projects. It creates and manages virtual python environments with just the required packages and their dependencies installed isolated from the system installed libraries, which is a boot for reproducible research and continuous integration.
### Install Poetry
Modern python installations often come with *pipx* or allow it to be easily installed, e.g. `brew install pipx` on Mac or `sudo apt install pipx` on Ubuntu based Linux distros.
``` shell
$ pipx install poetry
```
### Usage
Once installed you can start a shell in the correct python environment with all needed dependencies using :
```
$ poetry shell
```
On initial invocation it will create the environment from the lock file in the git repo.
The main configuration file is *pyproject.toml*, which is shared with a lot of other tools in thet python ecosystem. This allows the dependencies to be specified:
``` yaml
[tool.poetry]
name = "applied-econometrics-2024"
version = "0.1.0"
description = "Assignment for Applied Econometrics"
authors = ["Henrik Tillemans <hendrik@snamellit.com>"]
readme = "README.md"
package-mode = false
[tool.poetry.dependencies]
python = "^3.12"
pandas = "^2.2.3"
numpy = "^2.2.0"
matplotlib = "^3.10.0"
spyder = "^5.4.3"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
```
Usually poetry does things as expected. If there are significant changes to the dependencies it might be necessary to update the virtual environment by "locking" the actual versions used by creating a *poetry.lock* file with the exact versions used:
``` shell
$ poetry lock
```
This will resolve the configured dependencies and all transitive dependencies in a coherent configuration and write all details to allow the exact same setup to be reproduced on another machine or at another time.
Updating the virtual environment is then done with
``` shell
$ poetry install
```
## LaTeX
### Installation
on Ubuntu derived Linux:
``` shell
$ sudo apt install texlive-full
```
on Mac
``` shell
$ brew install --cask mactex
```