Skip to content

Instantly share code, notes, and snippets.

@VincentRouvreau
Last active August 3, 2020 07:38
Show Gist options
  • Save VincentRouvreau/c101fbce20803ab05071d7fdb005850c to your computer and use it in GitHub Desktop.
Save VincentRouvreau/c101fbce20803ab05071d7fdb005850c to your computer and use it in GitHub Desktop.
FROM ubuntu:20.04
# Update and upgrade distribution
RUN apt-get update && \
apt-get upgrade -y
# Tools necessary for installing and configuring Ubuntu
RUN apt-get install -y \
apt-utils \
locales \
tzdata
# Timezone
RUN echo "Europe/Paris" | tee /etc/timezone && \
ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
# Locale with UTF-8 support
RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && \
locale-gen && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Required for Gudhi compilation
RUN apt-get install -y make \
g++ \
cmake \
graphviz \
perl \
texlive-bibtex-extra \
biber \
libboost-all-dev \
libeigen3-dev \
libgmp3-dev \
libmpfr-dev \
libtbb-dev \
libcgal-dev \
locales \
python3 \
python3-pip \
python3-pytest \
python3-tk \
python3-pybind11 \
libfreetype6-dev \
pkg-config \
curl \
python3-matplotlib \
ghostscript \
dvipng
RUN pip3 install \
numpy \
matplotlib \
scipy \
Cython \
POT \
scikit-learn
# apt clean up
RUN apt autoremove && rm -rf /var/lib/apt/lists/*
RUN curl -LO "https://github.com/GUDHI/gudhi-devel/releases/download/tags%2Fgudhi-release-3.2.0/gudhi.3.2.0.tar.gz" \
&& tar xf gudhi.3.2.0.tar.gz \
&& cd gudhi.3.2.0 \
&& mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GUDHI_PYTHON=OFF -DPython_ADDITIONAL_VERSIONS=3 .. \
&& make all test install \
&& cmake -DWITH_GUDHI_PYTHON=ON . \
&& cd python \
&& python3 setup.py install
@VincentRouvreau
Copy link
Author

A python example to reproduce the issue - https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/simple_plot.html:

import matplotlib
import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()

fig.savefig("test.png")

The error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 302, in _run_checked_subprocess
    report = subprocess.check_output(command,
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '/root/.cache/matplotlib/tex.cache/9eb8ed50c4f119894612567ddda7eb11.tex']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 2082, in print_figure
    result = print_method(
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 527, in print_png
    FigureCanvasAgg.draw(self)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 388, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1708, in draw
    mimage._draw_list_compositing_images(
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2607, in draw
    self._update_title_position(renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2556, in _update_title_position
    if title.get_window_extent(renderer).ymin < top:
  File "/usr/lib/python3/dist-packages/matplotlib/text.py", line 890, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/text.py", line 289, in _get_layout
    _, lp_h, lp_d = renderer.get_text_width_height_descent(
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 200, in get_text_width_height_descent
    w, h, d = texmanager.get_text_width_height_descent(
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 448, in get_text_width_height_descent
    dvifile = self.make_dvi(tex, fontsize)
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 336, in make_dvi
    self._run_checked_subprocess(
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 310, in _run_checked_subprocess
    raise RuntimeError(
RuntimeError: latex was not able to process the following string:
b'lp'

Here is the full report generated by latex:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(/root/.cache/matplotlib/tex.cache/9eb8ed50c4f119894612567ddda7eb11.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))

! LaTeX Error: File `type1cm.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 
         
l.4 ^^M
       
No pages of output.
Transcript written on 9eb8ed50c4f119894612567ddda7eb11.log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment