But this has been built mainly for Linux and OS X platforms and doesnt support Windows Jupyter notebook.
The below steps helps to setup the environment on Windows using WSL
If you have not used WSL before on windows, please follow the steps from Microsoft here
Install Ubuntu for Windows from Windows Store. I’m using Ubuntu 18.04.
Other supported Linux flavours can be used. I have not yet tried though.
Install miniconda from https://conda.io/miniconda.html
Please download Linux version for your 32/64 bit system accordingly.
Miniconda3-latest-Linux-x86_64.sh for my 64-bit WIndows.
Init and update conda. Init will add the required bootstrapping in your bashrc
conda init conda update conda
Create a environment for cpp
conda create -n cpp
Activate the environment
conda activate cpp
Install Jupyter notebook, xeus-cling and required cpp extensions
conda install notebook conda install -c conda-forge xeus-cling conda install -c conda-forge jupyter_contrib_nbextensions conda install -c conda-forge jupyter_nbextensions_configurator jupyter nbextensions_configurator enable --user
Now that everything is setup, choose a directory for your notebooks
cd ~/cpp-books conda activate cpp
Run Jupyter notebook with
--no-browser option as we are in WSL and paths are not valid directly to open a page in windows.
jupyter notebook --no-browser
Generate a editable default config for Jupyter
jupyter notebook --generate-config echo c.NotebookApp.use_redirect_file = False >> ~/.jupyter/jupyter_notebook_config.py
Set your desired Windows Browser variable like
export BROWSER="/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
With above config and
BROWSER env variable set, no need to add
--no-browser option. Just run
Inside WSL create a script file to set the environment and run Notebook
$ cat ~/note
#!/bin/bash cd ~/cpp-books source ~/miniconda3/etc/profile.d/conda.sh conda activate cpp export BROWSER="/mnt/c/Program Files/Mozilla Firefox/firefox.exe" jupyter notebook
Change paths accordingly
Now from Windows Desktop, Right click and Create a new Shortcut.
Set the location to
C:\Windows\System32\wsl.exe bash -c "source /home/<user>/note"
Now you can open the shortcut to view your notebooks on Windows browser
Additionally, in the shortcut properties change to start minimised.