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.

Requirements:

  • 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

NURS WK 6 ASSGN

Predicting the likelihood of a customer to make repeat purchases using logistic regression

Retreat Recap: Technical Teams Convene in Savannah

KERNEL NON LINEARE

Data Science as a Product

Time series data characteristics

Laws and Preprocessing of Text

Put A Pin In It

Sherlock Holmes throws his hands up in victory as he solves the case be examining his ‘crazy wall.’

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

Dynamic Graph Plotting — Matplotlib

Uses Of Tuple Functions In Python

Numpy Tutorial Part 2

Learning to implement Linear Regression from scratch in python.

Linear regression