-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a setup script to install Julia + IJulia (#1927)
- Loading branch information
Showing
5 changed files
with
77 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# Requirements: | ||
# - Run as non-root user | ||
# - Julia is already set up, with the setup-julia.bash command | ||
set -exuo pipefail | ||
|
||
# Install base Julia packages | ||
julia -e ' | ||
import Pkg; | ||
Pkg.update(); | ||
Pkg.add([ | ||
"HDF5", | ||
"IJulia" | ||
]); | ||
Pkg.precompile(); | ||
' | ||
|
||
# Move the kernelspec out to the system share location. Avoids | ||
# problems with runtime UID change not taking effect properly on the | ||
# .local folder in the jovyan home dir. move kernelspec out of home | ||
mv "${HOME}/.local/share/jupyter/kernels/julia"* "${CONDA_DIR}/share/jupyter/kernels/" | ||
chmod -R go+rx "${CONDA_DIR}/share/jupyter" | ||
rm -rf "${HOME}/.local" | ||
fix-permissions "${JULIA_PKGDIR}" "${CONDA_DIR}/share/jupyter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
set -exuo pipefail | ||
# Requirements: | ||
# - This script is run as the root user | ||
# - The JULIA_PKGDIR environment variable is set | ||
|
||
# Default julia version to install if env var is not set | ||
# Check https://julialang.org/downloads/ | ||
JULIA_VERSION="${JULIA_VERSION:-1.9.1}" | ||
|
||
# Figure out what architecture we are installing in | ||
JULIA_ARCH=$(uname -m) | ||
JULIA_SHORT_ARCH="${JULIA_ARCH}" | ||
if [ "${JULIA_SHORT_ARCH}" == "x86_64" ]; then | ||
JULIA_SHORT_ARCH="x64" | ||
fi | ||
|
||
# Figure out Julia Installer URL | ||
JULIA_INSTALLER="julia-${JULIA_VERSION}-linux-${JULIA_ARCH}.tar.gz" | ||
JULIA_MAJOR_MINOR=$(echo "${JULIA_VERSION}" | cut -d. -f 1,2) | ||
|
||
# Download and install Julia | ||
cd /tmp | ||
mkdir "/opt/julia-${JULIA_VERSION}" | ||
wget --progress=dot:giga "https://julialang-s3.julialang.org/bin/linux/${JULIA_SHORT_ARCH}/${JULIA_MAJOR_MINOR}/${JULIA_INSTALLER}" | ||
tar xzf "${JULIA_INSTALLER}" -C "/opt/julia-${JULIA_VERSION}" --strip-components=1 | ||
rm "${JULIA_INSTALLER}" | ||
|
||
# Link Julia installed version to /usr/local/bin, so julia launches it | ||
ln -fs /opt/julia-*/bin/julia /usr/local/bin/julia | ||
|
||
# Tell Julia where conda libraries are | ||
mkdir -p /etc/julia | ||
echo "push!(Libdl.DL_LOAD_PATH, \"${CONDA_DIR}/lib\")" >> /etc/julia/juliarc.jl | ||
|
||
# Create JULIA_PKGDIR, where user libraries are installed | ||
mkdir "${JULIA_PKGDIR}" | ||
chown "${NB_USER}" "${JULIA_PKGDIR}" | ||
fix-permissions "${JULIA_PKGDIR}" |