C++ For Jupyter Notebook

When I’m experimenting with models I typically prefer to have my math and code in the same place. Python is the language of choice for data scientists as it integrates seamlessly with Jupyter Notebook allowing for carefully placed analysis and explanations alongside code modules. However, recently I’ve been working on integrating a model into a piece of software where low latency is vital. C++ was the obvious answer in terms of language choice. I began looking for an interactive computing solution in C++ and eventually came across Xeus; a C++ kernel for Jupyter Notebook and Xeus-Cling; a C++ interpreter. Together, these two frameworks allow for seamless interactive computing.


  • Mac OS/Linux/(Windows is still experimental at the time of this article)
  • Conda package manager

Step 1: Install Conda

  • Download the conda package manager and install the appropriate version for your operating system

Step 2: Setup

Before you install the modules, you want to set up your own environment to prevent conflicts with your default setup. Open up a terminal and type ‘conda activate’. Enter the following commands

conda create -n cling

Next, you want to install cling to your particular environment.

conda install xeus-cling -c conda-forge

Finally, install Xeus:

conda install xeus -c conda-forge

Step 3: Open A Notebook

Open a shell and switch to your cling environment.

conda activate cling

Open a notebook

jupyter notebook

You should now see the option to create a C++ notebook in Jupyter.

Originally published at https://www.pranav.ai.




Computer Scientist Blog: www.pranav.ai Website: www.prandev.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

First Steps to Understand and Improve Your OLS Regression — Part 1

What do sports fans really want?

Introduction to Segment Trees

“Strikes and Gutters, Ups and Downs”

Metadata Management as a Strategic Imperative

Visualizing Geospatial Data with Uber’s Kepler.gl

Machine Learning with a Heart: Predicting Heart Disease

Recognizing Handwritten Digits with Scikit-learn

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pranav Ahluwalia

Pranav Ahluwalia

Computer Scientist Blog: www.pranav.ai Website: www.prandev.com

More from Medium

Two types of abstractions in Python: Instance of ; Inherited from

Calculate Memory Consumption of Python Code

How is Symbolic Differentiation Done in Python using SymPy?