diff --git a/CHANGELOG.md b/CHANGELOG.md index 939c158..f22fdf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Dockerfile b/Dockerfile index f7a16fa..d3efb2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +#FROM arm32v7/ubuntu:bionic FROM arm32v7/debian:buster USER root @@ -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 \ @@ -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 diff --git a/README.md b/README.md index 8852a38..09c569e 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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= make && make install cd .. -rm R-4.1.1 +rm R-3.3.3 ``` ### Create soft links @@ -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 @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 43399ed..f3d071d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/install.R b/install.R new file mode 100644 index 0000000..60bc329 --- /dev/null +++ b/install.R @@ -0,0 +1,2 @@ +install.packages('IRkernel', repos='http://cran.rstudio.com/') +IRkernel::installspec(name = 'ir', displayname = 'R 3.3')