Skip to content

Instantly share code, notes, and snippets.

Last active Sep 3, 2019
What would you like to do?

I wanted to compile cernroot on ubuntu with python3 bindings for ROOT (pyROOT).

This is what worked for me (Dockerfile)

Let’s go ahead and test it:

Build the docker:

mkdir pyROOT_docker
cd pyROOT_docker
docker build -t pyROOT_docker .

Run the docker (with x11 support)

docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
--name pyROOT_docker -v $(pwd)/workdir:/workdir \
--rm -it --user $(id -u) pyROOT_docker /bin/bash

Test the installation inside the docker:

micha@5be8c924103b:/$ . /root-build/bin/
micha@5be8c924103b:/$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.TBrowser()
<ROOT.TBrowser object ("Browser") at 0x35d8560>

... a TBrowser window opens ... win!

FROM ubuntu:18.04
USER root
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y install \
vim \
nano \
libgslcblas0 \
python3-numpy \
python3-scipy \
python3-matplotlib \
perl \
bc \
git \
liblapack3 \
libboost-all-dev \
gv ghostscript xterm x11-utils \
dialog \
python3-pip \
wget \
git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev
RUN pip3 install --upgrade pip
RUN pip3 install pythondialog
RUN wget && tar -zxvf root_v6.18.02.source.tar.gz && rm root_v6.18.02.source.tar.gz
RUN mkdir /root-build && cd /root-build; cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ../root-6.18.02
RUN cd /root-build; make -j6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment