Sign inGet started
← Back to all guides

Using JavaScript in Deepnote

By Filip Žitný

Updated on July 9, 2024

Deepnote is a versatile data science platform that supports multiple programming languages through various kernels. While Python is the primary language, Deepnote also supports other languages with custom Docker images.

For users looking to work with JavaScript, We have prepared a setup for a JavaScript kernel in Deepnote using a custom environment. We will provide detailed instructions on setting up and running a JavaScript kernel in Deepnote and tips for troubleshooting common issues.

Setting up the JavaScript kernel

Below is the Dockerfile required to set up a JavaScript kernel in Deepnote. This configuration ensures that the necessary dependencies are installed and the kernel is properly set up.

FROM deepnote/python:3.9

RUN pip install jupyter-console
RUN apt-get update -y && apt-get install -y g++ libzmq3-dev nodejs npm
RUN npm install -g ijavascript
RUN ijsinstall --install=global

RUN jupyter kernelspec list
RUN jupyter console --kernel javascript

ENV DEFAULT_KERNEL_NAME "javascript"

Example: Running Javascript code

console.log("Hello Deepnote");
function countBits(x) {
    let numBits = 0;
    while (x != 0) {
        numBits += 1;
        x &= x - 1;
    }
    return numBits;
}

console.log(countBits(6));
// output: 2

Troubleshooting tips

Kernel Not Found: Ensure the ijsinstall --install=global command is executed correctly and the kernel is listed using the Jupyter kernel spec list.

Code Execution Issues: Verify that the JavaScript syntax is correct and compatible with the ijavascript kernel.

In conclusion, Deepnote’s flexibility extends beyond Python, allowing for the integration of programming languages like JavaScript. The setup process is straightforward and opens up opportunities for further integrations. This demonstrates Deepnote’s versatility as a data science platform and its potential to cater to a wider range of user preferences and project requirements.

If you encounter further issues, please get in touch with our support. Happy JSing in Deepnote!

Filip Žitný

Data Scientist

Follow Filip on Twitter, LinkedIn and GitHub

That’s it, time to try Deepnote

Get started – it’s free
Book a demo

Footer

Solutions

  • Notebook
  • Data apps
  • Machine learning
  • Data teams

Product

Company

Comparisons

Resources

  • Privacy
  • Terms

© Deepnote