ROOT Version: 6.20/00
Platform: Debian GNU/Linux 10 (buster) Docker image
Compiler: g++ (Debian 8.3.0-6) 8.3.0
Python version: 3.7.6
Hi. I’m trying to build a minimal Docker image that has ROOT installed in a Debian Linux environment from source with Python 3.7 to do some validation studies using RooFit + RooStats. At the time of writing this, the only ROOT Docker image that has Python 3.7 in it is rootproject/root
which is built on Fedora, so I am attempting to build the image myself starting with the python:3.7-slim
image. The following Dockerfile is used:
ARG BASE_IMAGE=python:3.7-slim
FROM ${BASE_IMAGE} as base
SHELL [ "/bin/bash", "-c" ]
FROM base as builder
ARG ROOT_VERSION=6.20.00
# As this is builder can split up RUNs to make debugging easier
RUN apt-get -qq -y update && \
apt-get -qq -y install \
gcc \
g++ \
gfortran \
git \
wget \
cmake \
zlibc \
libblas3 \
zlib1g-dev \
libbz2-dev \
libx11-dev \
libxext-dev \
libxft-dev \
libxml2-dev \
libxpm-dev \
libz-dev && \
apt-get -y autoclean && \
apt-get -y autoremove
# c.f. https://root.cern.ch/building-root#options
RUN mkdir code && \
cd code && \
wget https://root.cern/download/root_v${ROOT_VERSION}.source.tar.gz && \
tar xvfz root_v${ROOT_VERSION}.source.tar.gz && \
mkdir build && \
cd build && \
cmake \
-Dcxx14=ON \
-Dtmva=OFF \
-Dpython=ON \
-DPYTHON_EXECUTABLE=$(which python3) \
-DCMAKE_INSTALL_PREFIX=/usr/local \
../root-${ROOT_VERSION} && \
cmake --build . -- -j$(($(nproc) - 1)) && \
cmake --build . --target install
FROM base
RUN apt-get -qq -y update && \
apt-get -qq -y install \
gcc \
g++ \
zlibc \
libblas3 \
zlib1g-dev \
libbz2-dev \
libx11-dev \
libxext-dev \
libxft-dev \
libxml2-dev \
libxpm-dev \
libz-dev && \
apt-get -y autoclean && \
apt-get -y autoremove
# Use C.UTF-8 locale to avoid issues with ASCII encoding
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PYTHONPATH=/usr/local/lib:$PYTHONPATH
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/lib /usr/local/lib
COPY --from=builder /usr/local/include /usr/local/include
COPY --from=builder /usr/local/share /usr/local/share
COPY --from=builder /usr/local/etc /usr/local/etc
WORKDIR /home/data
ENV HOME /home
ENTRYPOINT ["/bin/bash"]
So far so good (though if I really just need RooFit + RooStats suggestions for what to turn OFF would be very welcome!), but the problem comes when I try to use it. If I build the Docker image with
docker build . \
-f Dockerfile \
--build-arg BASE_IMAGE=python:3.7-slim \
--build-arg ROOT_VERSION=6.20.00 \
--tag test-build:latest
then the following will run fine as expected
docker run \
--rm \
test-build:latest \
-c "python -m pip install numpy; python -c 'import numpy as np; import ROOT; print(np.arange(10))'"
but switching the import order of ROOT and NumPy causes a segfault
docker run \
--rm \
test-build:latest \
-c "python -m pip install numpy; python -c 'import ROOT; import numpy as np'"
running this in the REPL gives
root@9437c1dfe296:~/data# python
Python 3.7.6 (default, Feb 26 2020, 15:44:31)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> import numpy
*** Break *** segmentation violation
Generating stack trace...
0x00007f87c40207d1 in PyErr_SetString at /usr/src/python/Python/errors.c:170 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f8795f2fc7b in <unknown> from /usr/local/lib/python3.7/lib-dynload/_hashlib.cpython-37m-x86_64-linux-gnu.so
0x00007f8795f2f4ef in <unknown> from /usr/local/lib/python3.7/lib-dynload/_hashlib.cpython-37m-x86_64-linux-gnu.so
0x00007f87c3f9d5a3 in _PyMethodDef_RawFastCallKeywords at /usr/src/python/Objects/call.c:719 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9d410 in _PyCFunction_FastCallKeywords at /usr/src/python/Objects/call.c:737 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c40124e3 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4568 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400d7a9 in PyEval_EvalCodeEx at /usr/src/python/Python/ceval.c:3966 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400d76b in PyEval_EvalCode at /usr/src/python/Python/ceval.c:530 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4086dd4 in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9dc75 in _PyMethodDef_RawFastCallDict at /usr/src/python/Objects/call.c:531 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9d960 in _PyCFunction_FastCallDict at /usr/src/python/Objects/call.c:589 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e5d2 in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:433 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4012642 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ec12 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ec9a in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e20d in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f9db in _PyObject_CallMethodIdObjArgs at /usr/src/python/Objects/call.c:1255 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c40287d1 in PyImport_ImportModuleLevelObject at /usr/src/python/Python/import.c:1648 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400c698 in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f585 in PyCFunction_Call at /usr/src/python/Objects/call.c:759 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ed34 in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:376 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f427ca in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400d7a9 in PyEval_EvalCodeEx at /usr/src/python/Python/ceval.c:3966 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400d76b in PyEval_EvalCode at /usr/src/python/Python/ceval.c:530 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4086dd4 in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9dc75 in _PyMethodDef_RawFastCallDict at /usr/src/python/Objects/call.c:531 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9d960 in _PyCFunction_FastCallDict at /usr/src/python/Objects/call.c:589 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e5d2 in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:433 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4012642 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ec12 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ec9a in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e20d in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f9db in _PyObject_CallMethodIdObjArgs at /usr/src/python/Objects/call.c:1255 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c40287d1 in PyImport_ImportModuleLevelObject at /usr/src/python/Python/import.c:1648 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400c698 in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f585 in PyCFunction_Call at /usr/src/python/Objects/call.c:759 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ed34 in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:376 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f427ca in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400d7a9 in PyEval_EvalCodeEx at /usr/src/python/Python/ceval.c:3966 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400d76b in PyEval_EvalCode at /usr/src/python/Python/ceval.c:530 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4086dd4 in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9dc75 in _PyMethodDef_RawFastCallDict at /usr/src/python/Objects/call.c:531 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9d960 in _PyCFunction_FastCallDict at /usr/src/python/Objects/call.c:589 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e5d2 in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:433 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4012642 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ec12 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ec9a in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e20d in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f9db in _PyObject_CallMethodIdObjArgs at /usr/src/python/Objects/call.c:1255 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c40287d1 in PyImport_ImportModuleLevelObject at /usr/src/python/Python/import.c:1648 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f879618b795 in <unknown> from /usr/local/lib/python3.7/site-packages/numpy/random/_bit_generator.cpython-37m-x86_64-linux-gnu.so
0x00007f8796187aad in <unknown> from /usr/local/lib/python3.7/site-packages/numpy/random/_bit_generator.cpython-37m-x86_64-linux-gnu.so
0x00007f87c406a7f3 in PyModule_ExecDef at /usr/src/python/Objects/moduleobject.c:415 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c408c48c in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9dc90 in _PyMethodDef_RawFastCallDict at /usr/src/python/Objects/call.c:498 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9d960 in _PyCFunction_FastCallDict at /usr/src/python/Objects/call.c:589 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e5d2 in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:433 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4012642 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ec12 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ec9a in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e20d in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f9db in _PyObject_CallMethodIdObjArgs at /usr/src/python/Objects/call.c:1255 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c40287d1 in PyImport_ImportModuleLevelObject at /usr/src/python/Python/import.c:1648 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400c698 in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f585 in PyCFunction_Call at /usr/src/python/Objects/call.c:759 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9ed34 in _PyFunction_FastCallDict at /usr/src/python/Objects/call.c:376 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9f745 in PyObject_CallFunction at /usr/src/python/Objects/call.c:964 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c40281fa in PyImport_Import at /usr/src/python/Python/import.c:1950 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c408c61e in PyImport_ImportModule at /usr/src/python/Python/import.c:1390 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87963bba58 in <unknown> from /usr/local/lib/python3.7/site-packages/numpy/random/mtrand.cpython-37m-x86_64-linux-gnu.so
0x00007f87c406a7f3 in PyModule_ExecDef at /usr/src/python/Objects/moduleobject.c:415 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c408c48c in <unknown> from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9dc90 in _PyMethodDef_RawFastCallDict at /usr/src/python/Objects/call.c:498 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9d960 in _PyCFunction_FastCallDict at /usr/src/python/Objects/call.c:589 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4013899 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4641 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400daa1 in _PyEval_EvalCodeWithName at /usr/src/python/Python/ceval.c:3930 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e5d2 in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:433 (discriminator 4) from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c4012642 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ec12 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c3f9e52a in _PyFunction_FastCallKeywords at /usr/src/python/Objects/call.c:285 from /usr/local/lib/libpython3.7m.so.1.0
0x00007f87c400ee31 in _PyEval_EvalFrameDefault at /usr/src/python/Python/ceval.c:4621 from /usr/local/lib/libpython3.7m.so.1.0
- Why is this happening?
- Why does the import order matter?
- What can be done in the build to fix this?
- If I only care about RooFit + RooStats for this image how can I slim down the image more (turn off more of the build)?