Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Version 0.2

### Added
- R 3.3.3 to Dockerfile

### Changed
- switched from 'pip3 install' to 'python -m pip install' commands

## Version 0.1

### Added
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#FROM arm32v7/ubuntu:bionic
FROM arm32v7/debian:buster

USER root
Expand All @@ -10,14 +11,22 @@ RUN apt-get update && apt-get -y install --no-install-recommends \
gfortran \
libatlas-base-dev \
libc-ares-dev \
libcurl4-openssl-dev \
libbz2-dev \
libeigen3-dev \
libffi-dev \
libfreetype6-dev \
libgit2-dev \
libhdf5-103 \
libhdf5-dev \
libhdf5-serial-dev \
liblzma-dev \
libopenmpi-dev \
libpng-dev \
libpcre3 \
libpcre3-dev \
libreadline-dev \
libxml2-dev \
openmpi-bin \
openssl \
python3 \
Expand Down Expand Up @@ -73,6 +82,23 @@ RUN sed -i "/c.NotebookApp.open_browser/c c.NotebookApp.open_browser = False" /r
&& sed -i "/c.NotebookApp.password/c c.NotebookApp.password = '`cat password`'" /root/.jupyter/jupyter_notebook_config.py \
&& rm -f password

# Install R
ENV R_VERSION 3.3.3
ADD https://ftp.fau.de/cran/src/base/R-${R_VERSION:0:1}/R-${R_VERSION}.tar.gz .
RUN apt-get remove r-base
RUN tar -xvf R-${R_VERSION}.tar.gz \
&& rm R-${R_VERSION}.tar.gz \
&& cd R-${R_VERSION} \
&& ./configure --with-x=no --disable-java --with-pcre1 --prefix=/root/R \
&& make && make install \
&& cd .. \
&& rm -rf R-${R_VERSION} \
&& ln -s /root/R/bin/R /usr/bin/R \
&& ln -s /root/R/bin/Rscript /usr/bin/Rscript

COPY ./install.R /root
RUN Rscript /root/install.R

# Add volume for notebooks
VOLUME /root/notebooks

Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Machine Learning with JupyterLab on a Raspberry Pi

![platform](https://img.shields.io/badge/platforms-RaspberryPi-silver)
[![version](https://img.shields.io/badge/version-%200.1.0-blue)](https://github.com/smirko-dev/machine-learning-rpi/blob/main/CHANGELOG.md)
![platform](https://img.shields.io/badge/platforms-linux/arm-silver)
[![version](https://img.shields.io/badge/version-%200.2.0-blue)](https://github.com/smirko-dev/machine-learning-rpi/blob/main/CHANGELOG.md)
[![](https://img.shields.io/badge/license-MIT-blue)](https://github.com/smirko-dev/machine-learning-rpi/blob/main/LICENSE)
[![](https://img.shields.io/badge/dockerhub-smirko%2Fmachine--learning--rpi-blue?logo=docker)](https://hub.docker.com/r/smirko/machine-learning-rpi)
![](https://img.shields.io/docker/pulls/smirko/machine-learning-rpi?logo=docker)
[![](https://img.shields.io/docker/pulls/smirko/machine-learning-rpi?logo=docker)](https://hub.docker.com/r/smirko/machine-learning-rpi)
[![](https://img.shields.io/docker/image-size/smirko/machine-learning-rpi/latest?logo=docker)](https://hub.docker.com/r/smirko/machine-learning-rpi)

Run [Jupyter Lab](https://jupyter.org) with [Tensorflow](https://www.tensorflow.org) on a [Raspberry Pi](https://www.raspberrypi.org) as a service or within a docker container.

Expand Down Expand Up @@ -185,14 +186,14 @@ sudo apt-get install -y --no-install-recommends \
### Build and install binaries

```sh
wget https://ftp.fau.de/cran/src/base/R-4/R-4.1.1.tar.gz
tar -xvf R-4.1.1.tar.gz
rm R-4.1.1.tar.gz
cd R-4.1.1
wget https://ftp.fau.de/cran/src/base/R-3/R-3.3.3.tar.gz
tar -xvf R-3.3.3.tar.gz
rm R-3.3.3.tar.gz
cd R-3.3.3
./configure --with-x=no --disable-java --with-pcre1 --prefix=<r_home_directory>
make && make install
cd ..
rm R-4.1.1
rm R-3.3.3
```

### Create soft links
Expand Down Expand Up @@ -243,6 +244,7 @@ If the status command shows "active (running)" the Jupyter Lab should be reachab
The docker container is based on [Debian Buster](https://hub.docker.com/r/arm32v7/debian/) for arm32v7 and installs
- [TensorFlow](https://www.tensorflow.org/) from [tensorflow-on-arm](https://github.com/lhelontra/tensorflow-on-arm) or [tensorflow-arm-bin](https://github.com/bitsy-ai/tensorflow-arm-bin)
- [NumPy](https://numpy.org/), [SciPy](https://www.scipy.org/), [Scikit-learn](https://scikit-learn.org/stable/index.html), [Matplotlib](https://matplotlib.org) and [Pandas](https://pandas.pydata.org/)
- [The R Project for Statistical Computing](https://www.r-project.org/)
- [Tini](https://github.com/krallin/tini) which operates as a process subreaper for jupyter to prevent kernel crashes
- [Jupyter Notebook](https://jupyter.org/) with [Jupyter Lab](https://jupyterlab.readthedocs.io/en/stable/) as a simple [notebook server](https://jupyter-notebook.readthedocs.io/en/stable/public_server.html) with password protection

Expand All @@ -251,6 +253,7 @@ The docker container is based on [Debian Buster](https://hub.docker.com/r/arm32v
- JUPYTER_PASSWORD = jupyter
- TINI_VERSION = 0.19.0 (used for build only)
- TENSORFLOW_VERSION = 2.4.0 (used for build only)
- R_VERSION = 3.3.3 (used for build only)

### Install packages

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
# - JUPYTER_PASSWORD=jupyter
# - TINI_VERSION=0.19.0
# - TENSORFLOW_VERSION=2.4.0
# - R_VERSION=3.3.3
ports:
- 8881:8888
volumes:
Expand Down
2 changes: 2 additions & 0 deletions install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
install.packages('IRkernel', repos='http://cran.rstudio.com/')
IRkernel::installspec(name = 'ir', displayname = 'R 3.3')