Sign inSign up

robfraz/python-and-r

By robfraz

•Updated almost 7 years ago

Python v3.7.4 and R v3.6.1, along with various GAM-related R packages.

Image
0

10K+

robfraz/python-and-r repository overview

Using rocker/r-ver:3.6.1 as the base image, Python v3.7.4 has been installed along with the following R packages:

  • dplyr
  • gridExtra
  • mgcv
  • mgcViz
  • qgam
  • MLmetrics

Also includes FreeTDS and libODBC for SQL Server access. See Dockerfile below for more detail.

The Dockerfile is as follows:


FROM rocker/r-ver:3.6.1

# For controlling the version of Python to be installed.
ARG PYTHON_MAJOR_VERSION=3
ARG PYTHON_MINOR_VERSION=7
ARG PYTHON_BUGFIX_VERSION=4
ARG PYTHON_VERSION=${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}
ARG PYTHON_VERSION_FULL=${PYTHON_VERSION}.${PYTHON_BUGFIX_VERSION}

# So we can fetch stuff we want to install.
RUN apt-get update && apt-get install -y wget

# Install Python dependencies.
# Some of these are not strict deps for the Python install itself, but are often needed by
# Python packages (such as rpy) that will likely get installed downstream from this image.
RUN apt-get -y install \
    build-essential \
    libbz2-dev \
    libc6-dev \
    libffi-dev \
    libgdbm-dev \
    libicu-dev \
    liblzma-dev \
    libncursesw5-dev \
    libpcre3-dev \
    libreadline-dev \
    libsqlite3-dev \
    libssl-dev \
    openssl \
    python-dev \
    python-pip \
    python-setuptools \
    python-smbus \
    tk-dev \
    zlib1g-dev

# Install Python.
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION_FULL}/Python-${PYTHON_VERSION_FULL}.tgz && \
    tar -zxf Python-${PYTHON_VERSION_FULL}.tgz && \
    (cd Python-${PYTHON_VERSION_FULL} && ./configure && make && make install) && \
    rm -f Python-${PYTHON_VERSION_FULL}.tgz && \
    rm -rf Python-${PYTHON_VERSION_FULL}

# Install/upgrade pip to the latest available.
RUN python3 -m pip install --upgrade pip

# Compile latest versions of unixODBC and FreeTDS to support SQL Server querying.
RUN wget http://www.unixodbc.org/unixODBC-2.3.7.tar.gz && \
    tar -zxvf unixODBC*.tar.gz && \
    (cd unixODBC*/ && ./configure && make && make install) && \
    rm -rf unixODBC* && \
    wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.1.20.tar.gz && \
    tar -zxvf freetds*.tar.gz && \
    (cd freetds*/ && ./configure --with-unixodbc=/usr/local && make && make install) && \
    rm -rf freetds* && \
    ldconfig

# Install R packages (very slow) and clean /tmp afterwards in the hope this reduces the image size.
RUN R -e 'install.packages(c("dplyr", "gridExtra", "mgcv", "mgcViz", "qgam", "MLmetrics"))' && rm -rf /tmp/*

Tag summary

Content type

Image

Digest

Size

424.2 MB

Last updated

about 8 years ago

docker pull robfraz/python-and-r