🏠 back to Observable

Python (Pyodide) on Observable running Clustergrammer2

Hi, I wanted to share a notebook I recently made using Pyodide to run Python on ObservableHQ. The notebook allows users to upload their own high-dimensional data (three datasets are provided as examples), normalize their data (Z-score), perform hierarchical clustering on the rows and columns using clustergrammer2_core (built upon scipy etc), and visualize the results as an interactive WebGL heatmap using clustergrammer-gl

Currently, users have to upload their data using the file attachment tool in Observable and change the path to the file in the appropriate cell in order to have their data load - I’m wondering if that process can be streamlined. Also, the load time can be kind of long, but this appears to be caused by the necessary micropip installation step.

There seems to be a lot of potential for running Python code on Observable. I recently heard of Pyodide from the Jupyter-Lite project.


This is amazing! thank you for sharing. Now I want to see how to load umap-learn :slight_smile:

1 Like

So far I haven’t been able to import umap from umap-learn

One issue is that numba is not supported in Pyodide

Thanks! I was blocked by the same error but I didn’t know what was causing it

1 Like

I wonder if there’s an older umap-learn version that does not use numba?

t-SNE (via sklearn) works on Pyodide :grinning:


I’ll update with a t-SNE/heatmap linked view later (something similar to this https://observablehq.com/d/6eb6e4c492b7d2a4)

I might try this web worker UMAP.js approach later too UMAP playground / John Alexis Guerra Gómez / Observable


hi @cornhundred, I’d be curious to see your notebook, could you please enable access? thanks

@radames forgot to hit publish :smiley:

1 Like