-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathinstall_jupyter.sh
executable file
·69 lines (53 loc) · 2.09 KB
/
install_jupyter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
## build ARGs
NCPUS=${NCPUS:-"-1"}
NB_USER=${NB_USER:-${DEFAULT_USER:-"rstudio"}}
# a function to install apt packages only if they are not installed
function apt_install() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
fi
}
apt_install \
git \
sudo \
libzmq3-dev
# set up the default user if it does not exist
if ! id -u "${NB_USER}" >/dev/null 2>&1; then
/rocker_scripts/default_user.sh "${NB_USER}"
fi
# install python & setup venv
# shellcheck source=/dev/null
source /rocker_scripts/install_python.sh
python3 -m pip install --no-cache-dir jupyter-rsession-proxy notebook jupyterlab jupyterhub
install2.r --error --skipmissing --skipinstalled -n "$NCPUS" remotes
R --quiet -e 'remotes::install_github("IRkernel/IRkernel@*release")'
R --quiet -e 'IRkernel::installspec(user = FALSE)'
# Install texlive if it has not already been installed
if ! command -v tlmgr; then
# shellcheck source=/dev/null
source /rocker_scripts/install_texlive.sh
fi
# If we are using official Ubuntu binaries, we do not need tex packages installed manually with tlmgr
if [[ ! -x "/usr/bin/latex" ]]; then
# Install tex packages needed for Jupyter's nbconvert to work correctly & convert to PDF
# Sourced from https://github.com/jupyter/nbconvert/issues/1328
tlmgr install adjustbox caption collectbox enumitem environ eurosym etoolbox jknapltx parskip \
pdfcol pgf rsfs tcolorbox titling trimspaces ucs ulem upquote \
ltxcmds infwarerr iftex kvoptions kvsetkeys float geometry amsmath fontspec \
unicode-math fancyvrb grffile hyperref booktabs soul ec
fi
# Clean up
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/downloaded_packages
## Strip binary installed lybraries from RSPM
## https://github.com/rocker-org/rocker-versioned2/issues/340
strip /usr/local/lib/R/site-library/*/libs/*.so
# Check jupyter
echo -e "Check the avalable jupyter kernels...\n"
jupyter kernelspec list
echo -e "\nInstall jupyter, done!"