If you need to work with different language then Python, the Jupyter ecosystem provides you with a vast selection of other kernels. You can now run them in Deepnote! We provide examples for R, Julia and Bash.
Just go to project with R version 3.5.2 or R version 4.0.3
These links create a project from our R template.
Edit the Dockerfile in the environment tab with this initialisation code, build the custom environment cache and restart the machine.
# R version 3.5.2FROM deepnote/python:3.7RUN sudo apt-get update && \sudo apt-get install -y r-base libcurl4-openssl-dev libssl-dev libxml2-devRUN pip install notebookRUN sudo R -e "install.packages('IRkernel', repos='http://cran.rstudio.com/')"RUN R -e "IRkernel::installspec()"RUN sudo echo "setwd('~/work')" > ~/.RprofileENV R_LIBS_USER "~/work/.R/library"# Set default kernel to RENV DEFAULT_KERNEL_NAME "ir"
# R version 4.0.3FROM deepnote/python:3.7RUN echo "deb http://cloud.r-project.org/bin/linux/debian buster-cran40/" | sudo tee -a /etc/apt/sources.list && \sudo apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF' && \sudo apt update && \sudo apt install -y -t buster-cran40 r-base libcurl4-openssl-dev libssl-dev libxml2-devRUN pip install notebookRUN sudo R -e "install.packages('IRkernel', repos='http://cran.rstudio.com/')"RUN R -e "IRkernel::installspec()"RUN sudo echo "setwd('~/work')" > ~/.RprofileENV R_LIBS_USER "~/work/.R/library"ENV DEFAULT_KERNEL_NAME "ir"
Deepnote uses the environment variable DEFAULT_KERNEL_NAME
that you set in the Dockerfile and uses it to create new notebooks with that kernel.
You can simply use the install.packages
and library
commands the way you normally would.
R packages take a long time to install, sometimes 10-20 minute for a larger package set. Reinstalling all of them at every hardware restart would lead to a lot of waiting.
One option is to bake them into the Dockerfile by installing at build time.
A second option is setting the env. variableR_LIBS_USER="/home/jovyan/work/.R/library"
which ensures that the packages are installed in the work
folder, which gets persisted. You can simply copy the corresponding ENV
line into your Dockerfile. Note, the directory must exist before it can be used for installation, so consider also adding ! mkdir -p ./.R/library
into your init.ipynb
(see Custom initialization).
Edit the Dockerfile in the environment tab with this initialisation code, build the custom environment cache and restart the machine.
FROM gcr.io/deepnote-200602/templates/deepnoteRUN wget https://julialang-s3.julialang.org/bin/linux/x64/1.4/julia-1.4.2-linux-x86_64.tar.gz && \tar -xvzf julia-1.4.2-linux-x86_64.tar.gz && \sudo mv julia-1.4.2 /usr/lib/ && \sudo ln -s /usr/lib/julia-1.4.2/bin/julia /usr/bin/julia && \rm julia-1.4.2-linux-x86_64.tar.gz && \julia -e "using Pkg;pkg\"add IJulia\""ENV DEFAULT_KERNEL_NAME "julia-1.4"
Edit the Dockerfile in the environment tab with this initialisation code, build the custom environment cache, and restart the machine.
FROM gcr.io/deepnote-200602/templates/deepnoteRUN pip install bash_kernel && python -m bash_kernel.installENV DEFAULT_KERNEL_NAME "bash"
Edit the Dockerfile in the environment tab with this initialization code, build the custom environment cache, and restart the machine.
FROM gcr.io/deepnote-200602/templates/deepnoteRUN wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -RUN sudo apt updateRUN sudo apt install -y software-properties-commonRUN sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/RUN sudo apt updateRUN sudo mkdir /usr/share/man/man1RUN sudo apt install -y adoptopenjdk-8-hotspotRUN curl -Lo coursier https://git.io/coursier-cliRUN chmod +x coursierRUN ./coursier launch --fork almond:0.10.9 --scala 2.12.12 -- --installRUN rm -f coursierENV DEFAULT_KERNEL_NAME "scala"
Or clone this project from Deepnote.
Edit the Dockerfile in the environment tab with this initialization code, build the custom environment cache, and restart the machine.
FROM gcr.io/deepnote-200602/templates/deepnote# The following snippet is licensed under MIT license# SEE: https://github.com/jackfirth/racket-dockerRUN sudo apt-get update && \sudo apt-get install -y libzmq5ENV RACKET_INSTALLER_URL=http://mirror.racket-lang.org/installers/7.8/racket-7.8-x86_64-linux-natipkg.shENV RACKET_VERSION=7.8RUN wget --output-document=racket-install.sh -q ${RACKET_INSTALLER_URL} && \echo "yes\n1\n" | sudo sh racket-install.sh --create-dir --unix-style --dest /usr/ && \rm racket-install.shENV SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"ENV SSL_CERT_DIR="/etc/ssl/certs"RUN sudo raco setupRUN raco pkg config --set catalogs \"https://download.racket-lang.org/releases/${RACKET_VERSION}/catalog/" \"https://pkg-build.racket-lang.org/server/built/catalog/" \"https://pkgs.racket-lang.org" \"https://planet-compats.racket-lang.org"RUN raco pkg install --auto iracketRUN raco iracket installENV DEFAULT_KERNEL_NAME "racket"
Thanks, @dkvasnickajr for sharing this!
You can clone this project from Deepnote.