DEV Community

Chris Achinga
Chris Achinga

Posted on • Originally published at chrisdevcode.hashnode.dev on

Using JavaScript in JupyterLab

TL;DR This post will take you through installing JupyterLabs and how to add a NodeJS kernel to it in Ubuntu.

Installing JupyterLabs

For a better experience, you should install Jupyter Lab inside a virtual environment.

sudo apt install python3-venv

Enter fullscreen mode Exit fullscreen mode

After the installation is complete, create a new environment:

python3 -m venv jlab

Enter fullscreen mode Exit fullscreen mode

Note that you can replace the jlab with any name of your choice.

Now activate the environment:

. jlab/bin/activate

Enter fullscreen mode Exit fullscreen mode

Activating a virtual environment

Now install Jupyter Lab in Ubuntu:

pip install jupyterlab

Enter fullscreen mode Exit fullscreen mode

Once the installation is complete, you can start Jupyter lab by running:

jupyter lab

Enter fullscreen mode Exit fullscreen mode

Jupyter Labs runs locally on port 8888: http://localhost:8888/

Installing Javascript Kernel

Inside the activated virtual environment, install the javascript kernel by running:

npm install -g ijavascript

Enter fullscreen mode Exit fullscreen mode

To activate the kernel, run:

ijsinstall

Enter fullscreen mode Exit fullscreen mode

Re-start Jupyter lab:

jupyter lab

Enter fullscreen mode Exit fullscreen mode

Javascript in jupyter lab

To test it out, click on the NodeJS logo to start a Javascript lab:

Srunning javascript on jupyter lab

Conclusion

The article demonstrates how to install Jupyter labs in a virtual environment and add a JavaScript kernel.

Resources

https://www.youtube.com/watch?v=gkeh9phGgYo&list=PL1ROSNerT41L9l0-es4HFXyEyEmKwSya4&index=20&t=81s

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay