Skip to content
Snippets Groups Projects
Commit 220a91ff authored by Daniel Müller's avatar Daniel Müller :speech_balloon:
Browse files

Merge: Python packages in venv + configurations

parents 5cc97e9a 0c31b394
No related branches found
No related tags found
No related merge requests found
---
- hosts: localhost
vars:
target_user: pi
jupyter_service: true
ignore_python_version: false
pre_tasks:
- name: Check python version
fail:
msg: Python version is not supported. Set ignore_python_version to true to ignore this.
when: (not ignore_python_version) and not (ansible_python_version is version('3.7.0', '>=') and ansible_python_version is version('3.10.0', '<'))
# - name: Upgrade packages
# become: true
# apt:
......
......@@ -5,9 +5,9 @@ Description=Jupyter Lab
Type=simple
PIDFile=/run/jupyter.pid
# Password: [empty string]
ExecStart=/usr/bin/python3 -m jupyterlab --ip="0.0.0.0" --notebook-dir=/home/pi/notebooks --no-browser --NotebookApp.password='sha1:9a2d316959ac:843b251c27024afb46174ce40ce0ebebcf29217b'
User=pi
Group=pi
ExecStart=/home/{{ target_user }}/.ml-venv/bin/jupyter-lab --ip="0.0.0.0" --notebook-dir=/home/{{ target_user }}/notebooks --no-browser --NotebookApp.password='sha1:9a2d316959ac:843b251c27024afb46174ce40ce0ebebcf29217b'
User={{ target_user }}
Group={{ target_user }}
Restart=always
RestartSec=10
......
......@@ -3,10 +3,10 @@
- name: Notebooks dir
file:
path: /home/pi/notebooks
path: "/home/{{ target_user }}/notebooks"
state: directory
owner: pi
group: pi
owner: "{{ target_user }}"
group: "{{ target_user }}"
# This should be optimized so that only one check / install is needed
# Still we should make sure that pip3 is actually installed before trying to use it
......@@ -15,23 +15,25 @@
apt:
name:
- python3-pip
- python3-venv
state: present
update_cache: true
- name: Install jupyter-lab
become: true
pip:
executable: pip3
virtualenv_command: /usr/bin/python3 -m venv
virtualenv: "/home/{{ target_user }}/.ml-venv"
name: jupyterlab
state: present
- name: Install systemd service
become: true
copy:
template:
src: files/jupyter.service
dest: /etc/systemd/system/jupyter.service
mode: '0644'
when: jupyter_service
- name: Start Jupyter-Lab service
become: true
systemd:
......@@ -39,3 +41,5 @@
state: started
enabled: true
daemon_reload: true
when: jupyter_service
---
# roles/misc-applications
- name: Install useful cli applications
become: true
apt:
name:
- neovim
- tmux
state: present
numpy==1.21.*
matplotlib==3.4.*
pandas==1.3.*
Pillow==8.4.*
scikit-learn==1.0.*
......@@ -12,25 +12,23 @@
state: present
update_cache: true
- name: Remove conflicting apt packages
become: true
apt:
name:
- python3-pil
- python3-numpy
state: absent
- name: Copy requirements.txt to remote fs
copy:
src: files/requirements.txt
dest: /tmp/ml-requirements.txt
- name: Install ml python packages
become: true
pip:
executable: pip3
name:
- numpy
- sklearn
- matplotlib
- pandas
- Pillow
virtualenv_command: /usr/bin/python3 -m venv
requirements: /tmp/ml-requirements.txt
virtualenv: "/home/{{ target_user }}/.ml-venv"
# name:
# - numpy
# - sklearn
# - matplotlib
# - pandas
# - Pillow
# - torch
# - torchvision
# - fastai
state: present
# state: present
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment