Tuesday, April 18, 2023

Running C++ Code Snippets in Jupyter Notebooks

When I first encountered C++ on Jupyter Lab, I was excited to start experimenting with the Dockerfile for the same. Previously, I posted a Dockerfile in my post Programmer's Quest: C++ in Jupyter Docker (progquest.blogspot.com), but it is outdated.

Please use the following Dockerfile going forward. This docker works fine for all C++ (C++11, C++14 & C++17):
FROM docker.io/jupyter/scipy-notebook:latest

RUN mamba install -yn base nb_conda_kernels \
    && mamba create -yn xeus-cling boost \
    && mamba clean -qafy

>> docker build --rm -t mycpp-jupyter .

>> docker run -e PYDEVD_DISABLE_FILE_VALIDATION=1 -u $(id -u):$(id -g) -v $(pwd):$(pwd) -w $(pwd) -e HOME=$(pwd)/.home -it -d --init -p 8888:8888 --name mycpp mycpp-jupyter jupyter lab --ip=0.0.0.0 --port=8888 --no-browser

 

No comments:

Post a Comment