welfare-state-analytics / welfare_state_analytics

Welfare State Analytics
5 stars 0 forks source link

Install humlab-westac (Jupter Notebooks) #104

Closed roger-mahler closed 3 years ago

roger-mahler commented 3 years ago

Follow these steps to install the humlab-westac package:

Prerequisites

Chocolatey (Windows 10, recommended). Chocolatey is a Windows package installer that simplifies installation of pyenv and Python. To install Chocolatey you can follow these instructions. Python 3.8.5 Run python --version to determine the current version. Use pyenv to install Python 3.8.5: Pyenv (recommended) Pyenv enables easy switching between different Python versions. Use install instructions in automatic installer.

curl https://pyenv.run | bash
exec $SHELL

If you are installing on MacOS:

brew install xz

Install and set Python 3.8.5 as (user) global version:

pyenv install 3.8.5
pyenv global 3.8.5     (optional)
pyenv activate 3.8.5   (to activate this specific version)

Poetry Poetry is the Python package manager (comparable to pipenv) used by this project, and is needed in order to install humlab-westac in a separate and isolated environment. See this link on how to install Poetry. Note that Python 3.8.5 must be activated before installing Poetry.

On Linux/MacOS:

pyenv activate 3.8.5
python --version
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
poetry --version

On Windows

pyenv shell 3.8.5
python --version
pip install poetry
poetry --version

Please restart the terminal upon completed install.

Install humlab-westac

  1. Create a local folder (e.g. humlab-westac-deploy)
  2. Open a terminal in the very same folder
  3. Run the following commands:
    
    poetry self update

In directory

poetry init --python 3.8.5 poetry add humlab-westac


Install Node (if not already installed)
---------------------------------------
Use `brew` to install Node on MacOS:
```bash
brew install node

Windows 10: Download installer from this link.

Install Jupyter Lab extensions and NLTK data

poetry run python -m nltk.downloader stopwords punkt sentiwordnet

poetry run jupyter labextension install @jupyter-widgets/jupyterlab-manager @bokeh/jupyter_bokeh jupyter-matplotlib  jupyterlab-jupytext ipyaggrid qgrid2

git clone https://github.com/welfare-state-analytics/welfare_state_analytics.git

Run the Jupyter Notebooks

  1. Open a terminal in the humlab-westac folder
  2. Activate Python 3.8.5: pyenv activate 3.8.5 (MacOS) or pyenv shell 3.8.5 (Windows 10)
  3. Activate the humlab-westac isolated environment: poetry shell
  4. Start Jupyter Lab: jupyter lab .
roger-mahler commented 3 years ago

@fredrik1984 @Stubbendorff