cross reference from https://discourse.julialang.org/t/can-not-compile-plots-jl-…in-ubuntu-docker/85165
When I try to precompile plots I get
```
✗ Cairo_jll
✗ Qt5Base_jll
✗ HarfBuzz_jll
✗ libass_jll
✗ FFMPEG_jll
✗ FFMPEG
✗ GR_jll
✗ Plots
0 dependencies successfully precompiled in 19 seconds (131 already precompiled)
ERROR: The following 1 direct dependency failed to precompile:
Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home//.julia/compiled/v1.7/Plots/jl_ENsbui.
ERROR: LoadError: InitError: could not load library "/home/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so"
/home/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so: undefined symbol: g_uri_ref
Stacktrace:
[1] dlopen(s::String, flags::UInt32; throw_error::Bool)
@ Base.Libc.Libdl ./libdl.jl:117
[2] dlopen(s::String, flags::UInt32)
@ Base.Libc.Libdl ./libdl.jl:117
[3] macro expansion
@ /home/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
[4] __init__()
@ Glib_jll /home/.julia/packages/Glib_jll/2OVnY/src/wrappers/x86_64-linux-gnu.jl:36
[5] _include_from_serialized(path::String, depmods::Vector{Any})
@ Base ./loading.jl:768
[6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
@ Base ./loading.jl:854
[7] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1097
[8] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[9] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[10] include(mod::Module, _path::String)
@ Base ./Base.jl:418
[11] top-level scope
@ /home/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
[12] include
@ ./Base.jl:418 [inlined]
[13] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base ./loading.jl:1318
[14] top-level scope
@ none:1
[15] eval
@ ./boot.jl:373 [inlined]
[16] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[17] top-level scope
@ none:1
during initialization of module Glib_jll
in expression starting at /home/.julia/packages/Cairo_jll/HW4xi/src/wrappers/x86_64-linux-gnu.jl:4
in expression starting at /home/.julia/packages/Cairo_jll/HW4xi/src/Cairo_jll.jl:2
ERROR: LoadError: Failed to precompile Cairo_jll [83423d85-b0ee-5818-9007-b63ccbeb887a] to /home/.julia/compiled/v1.7/Cairo_jll/jl_P3YKFd.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[7] include(mod::Module, _path::String)
@ Base ./Base.jl:418
[8] top-level scope
@ /home/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
[9] include
@ ./Base.jl:418 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base ./loading.jl:1318
[11] top-level scope
@ none:1
[12] eval
@ ./boot.jl:373 [inlined]
[13] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[14] top-level scope
@ none:1
in expression starting at /home/.julia/packages/HarfBuzz_jll/zavaV/src/wrappers/x86_64-linux-gnu.jl:4
in expression starting at /home/.julia/packages/HarfBuzz_jll/zavaV/src/HarfBuzz_jll.jl:2
ERROR: LoadError: Failed to precompile HarfBuzz_jll [2e76f6c2-a576-52d4-95c1-20adfe4de566] to /home/.julia/compiled/v1.7/HarfBuzz_jll/jl_3pPsi2.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[7] include(mod::Module, _path::String)
@ Base ./Base.jl:418
[8] top-level scope
@ /home/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
[9] include
@ ./Base.jl:418 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base ./loading.jl:1318
[11] top-level scope
@ none:1
[12] eval
@ ./boot.jl:373 [inlined]
[13] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[14] top-level scope
@ none:1
in expression starting at /home/.julia/packages/libass_jll/SaaQW/src/wrappers/x86_64-linux-gnu.jl:6
in expression starting at /home/.julia/packages/libass_jll/SaaQW/src/libass_jll.jl:2
ERROR: LoadError: Failed to precompile libass_jll [0ac62f75-1d6f-5e53-bd7c-93b484bb37c0] to /home/.julia/compiled/v1.7/libass_jll/jl_39nTqQ.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[7] include(mod::Module, _path::String)
@ Base ./Base.jl:418
[8] top-level scope
@ /home/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
[9] include
@ ./Base.jl:418 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base ./loading.jl:1318
[11] top-level scope
@ none:1
[12] eval
@ ./boot.jl:373 [inlined]
[13] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[14] top-level scope
@ none:1
in expression starting at /home/.julia/packages/FFMPEG_jll/9kTcb/src/wrappers/x86_64-linux-gnu.jl:4
in expression starting at /home/.julia/packages/FFMPEG_jll/9kTcb/src/FFMPEG_jll.jl:2
ERROR: LoadError: Failed to precompile FFMPEG_jll [b22a6f82-2f65-5046-a5b2-351ab43fb4e5] to /home/.julia/compiled/v1.7/FFMPEG_jll/jl_l9YASC.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[7] include
@ ./Base.jl:418 [inlined]
[8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base ./loading.jl:1318
[9] top-level scope
@ none:1
[10] eval
@ ./boot.jl:373 [inlined]
[11] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[12] top-level scope
@ none:1
in expression starting at /home/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:1
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to /home/.julia/compiled/v1.7/FFMPEG/jl_3OQl2W.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[7] include
@ ./Base.jl:418 [inlined]
[8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base ./loading.jl:1318
[9] top-level scope
@ none:1
[10] eval
@ ./boot.jl:373 [inlined]
[11] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[12] top-level scope
@ none:1
in expression starting at /home/.julia/packages/Plots/SkUg1/src/Plots.jl:1
```
minimal working example at https://github.com/jakubMitura14/cudaDockerJulia
for reference below what I have in repository
Julia 1.7.2
Ubuntu 20.0
Dockerfile
```
## { Mitura start}
#FROM nvidia/cuda:11.3.1-devel-ubuntu20.04
FROM nvidia/cudagl:11.3.0-devel-ubuntu20.04
################################################################################
# Prevent apt-get from prompting for keyboard choice
# https://superuser.com/questions/1356914/how-to-install-xserver-xorg-in-unattended-mode
ENV DEBIAN_FRONTEND=noninteractive
# Remove any third-party apt sources to avoid issues with expiring keys.
RUN rm -f /etc/apt/sources.list.d/*.list
# Install some basic utilities
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
sudo \
git \
bzip2 \
libx11-6 \
build-essential \
wget\
manpages-dev\
g++\
gcc\
nodejs\
libssl-dev\
unzip\
&& rm -rf /var/lib/apt/lists/*
## installing github CLI - https://github.com/cli/cli/blob/trunk/docs/install_linux.md
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
RUN sudo apt update
RUN sudo apt install gh
RUN apt autoremove python3 -y
RUN mkdir /app
WORKDIR /app
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
RUN mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
RUN wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb
RUN dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb
RUN apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub
RUN apt-get update
RUN apt-get -y install cuda-11.3
RUN apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub
RUN echo 'APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;' >> /etc/apt/apt.conf && \
echo 'Dir::Cache::pkgcache "";\nDir::Cache::srcpkgcache "";' | tee /etc/apt/apt.conf.d/00_disable-cache-files
RUN apt-get update -q -y && \
apt-get install -q -y \
vim net-tools curl \
libgl1-mesa-glx \
xserver-xorg-video-dummy \
libxrender1 \
libpulse0 \
libpulse-mainloop-glib0 \
libnss3 \
libxcomposite1 \
libxcursor1 \
libfontconfig1 \
libxrandr2 \
libasound2 \
libglu1 \
x11vnc \
awesome \
jq \
nautilus\
jupyter-core\
zip\
p7zip-full\
apt-utils\
octave\
kmod\
zlib1g\
python-dev\
bzip2\
cmake\
cuda-command-line-tools-11.3 \
libcublas-11.3 \
cuda-nvrtc-11.3\
libcufft-11.3 \
libcurand-11.3 \
libcusolver-11.3 \
libcusparse-11.3 \
libfreetype6-dev \
curl\
libzmq3-dev \
pkg-config\
software-properties-common\
libhdf5-serial-dev\
git \
at-spi2-core \
libgtk-3-dev \
xauth \
xvfb \
ffmpeg && \
apt-get install -q -y --reinstall ca-certificates
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
# ERROR: no download agent available; install curl, wget, or fetch
curl \
; \
rm -rf /var/lib/apt/lists/*
ENV JULIA_PATH /usr/local/julia
ENV PATH $JULIA_PATH/bin:$PATH
# https://julialang.org/juliareleases.asc
# Julia (Binary signing key) <buildbot@julialang.org>
ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495
# https://julialang.org/downloads/
ENV JULIA_VERSION 1.7.2
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
if ! command -v gpg > /dev/null; then \
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg \
dirmngr \
; \
rm -rf /var/lib/apt/lists/*; \
fi; \
\
# https://julialang.org/downloads/#julia-command-line-version
# https://julialang-s3.julialang.org/bin/checksums/julia-1.7.3.sha256
arch="$(dpkg --print-architecture)"; \
case "$arch" in \
'amd64') \
url='https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.3-linux-x86_64.tar.gz'; \
sha256='9b2f4fa12d92b4dcc5d11dc66fb118c47681a76d3df8da064cc97573f2f5c739'; \
;; \
'armhf') \
url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.7/julia-1.7.3-linux-armv7l.tar.gz'; \
sha256='e9de15c56b9b62727c69d10da4b8e90fa6609d2e94e9cfb9f99128dfb59a8677'; \
;; \
'arm64') \
url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.7/julia-1.7.3-linux-aarch64.tar.gz'; \
sha256='d9e8b342c80ad1371520ed6d11f55b78aa60746737fbf57ecafd6a23b52dd71d'; \
;; \
'i386') \
url='https://julialang-s3.julialang.org/bin/linux/x86/1.7/julia-1.7.3-linux-i686.tar.gz'; \
sha256='c1e1a4f9a53affee269c7e740cb8bd46740f9021414459c3ab3bb2c540d9d499'; \
;; \
*) \
echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \
exit 1; \
;; \
esac; \
\
curl -fL -o julia.tar.gz.asc "$url.asc"; \
curl -fL -o julia.tar.gz "$url"; \
\
echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \
gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \
command -v gpgconf > /dev/null && gpgconf --kill all; \
rm -rf "$GNUPGHOME" julia.tar.gz.asc; \
\
mkdir "$JULIA_PATH"; \
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \
rm julia.tar.gz; \
\
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# smoke test
julia --version
# set up user
ENV NB_USER sliceruser
ENV NB_UID 1000
ENV HOME /home/${NB_USER}
ENV USER_HOME_DIR /home/${USER}
ENV JULIA_DEPOT_PATH ${USER_HOME_DIR}/.julia
ENV NOTEBOOK_DIR ${USER_HOME_DIR}/notebooks
ENV JULIA_NUM_THREADS 100
ENV JULIA_SSL_NO_VERIFY_HOSTS 'github.com'
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
WORKDIR ${HOME}
RUN chown -R ${NB_USER} /usr/share/X11
RUN chmod -R ugo+rwx /usr/share/X11
RUN chown -R ${NB_USER} /etc/X11
RUN chmod -R ugo+rwx /etc/X11
RUN chown -R ${NB_USER} /tmp/
RUN chmod -R ugo+rwx /tmp/
# RUN chown -R ${NB_USER} /dev/tty0
# RUN chmod -R ugo+rwx /dev/tty0
RUN git config --global user.name "Jakub Mitura"
RUN git config --global user.email "jakub.mitura14@gmail.com"
RUN git config -l
# RUN julia -e 'using Pkg; ENV["PLOTS_DEFAULT_BACKEND"] = "PlotlyJS"; Pkg.add(["Plots", "MedPipe3D"]); Pkg.instantiate();Pkg.precompile()'
#from https://discourse.julialang.org/t/configuring-docker-image-of-julia-julia-cant-see-installed-packages/48790/5
RUN julia -e 'import Pkg; Pkg.update()'
#RUN julia -e 'import Pkg; Pkg.add("Plots"); using Plots'
RUN git clone https://github.com/jakubMitura14/MedPipe3DTutorial.git ${HOME}/data/mainCode
################################################################################
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG IMAGE
ARG VCS_REF
ARG VCS_URL
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$IMAGE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.schema-version="1.0"
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
```
docker runtime arguments - I run it as vs code remote container
```
"runArgs": [
"--init", "--gpus", "all"
,"--ipc", "host",
"--net", "host",
"--privileged" ,
"-e", "DISPLAY=${env:DISPLAY}",
"-v", "/tmp/.X11-unix:/tmp/.X11-unix"
]
```