# Unable to view leaflet javascript on self-hosted JupyterLab instance?

**URL:** <https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416>\
**Category:** Visualization\
**Created:** [May 3, 2023, 11:18pm UTC](https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416 "2023-05-03T23:18:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cboettig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/cboettig/32/1788_2.png) [@cboettig](https://discourse.pangeo.io/u/cboettig)\
**Post date:** [May 3, 2023, 11:18pm UTC](https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416/1 "2023-05-03T23:18:50Z")

</div>

Javascript-based maps work wonderfully in other Jupyter notebooks (i.e. planetarycomputer), but fail to render on my personal jupyterlab server. e.g. I try:

```auto
import leafmap

m = leafmap.Map()
m

```

and I get the error

```auto
[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'LeafletMapModel' from module 'jupyter-leaflet'
Error: No version of module jupyter-leaflet is registered
    at f.loadClass (https://jupyter.thelio.carlboettiger.info/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856)
    at f.loadModelClass (https://jupyter.thelio.carlboettiger.info/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729)
    at f._make_model (https://jupyter.thelio.carlboettiger.info/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517)
    at f.new_model (https://jupyter.thelio.carlboettiger.info/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137)
    at f.handle_comm_open (https://jupyter.thelio.carlboettiger.info/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3894)
    at _handleCommOpen (https://jupyter.thelio.carlboettiger.info/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:73393)
    at b._handleCommOpen (https://jupyter.thelio.carlboettiger.info/static/lab/jlab_core.3e11c5239452d671150c.js?v=3e11c5239452d671150c:2:1037311)
    at async b._handleMessage (https://jupyter.thelio.carlboettiger.info/static/lab/jlab_core.3e11c5239452d671150c.js?v=3e11c5239452d671150c:2:1039301)

```

Not sure what I’ve done wrong here, maybe my Jupyterlab isn’t configured correctly or needs some additional port? I’ve installed the module and tried restarting the kernel. I see that jupyter-leaflet shows up as “installed” in my “extensions” tab too – despite what the error message says… (Apologies if this kind of issue would be better directed to another forum, please let me know!)

---

<div class="post-metadata">

**Author:** ![rabernat](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/rabernat/32/22_2.png) [@rabernat](https://discourse.pangeo.io/u/rabernat)\
**Post date:** [May 4, 2023, 12:35pm UTC](https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416/2 "2023-05-04T12:35:50Z")

</div>

Since this seems like a package-specific usage question / bug report, I feel you’d probably get a faster and better response on the leafmap issue tracker:

> **[GitHub - opengeos/leafmap: A Python package for interactive mapping and...](https://github.com/opengeos/leafmap)**
>
> A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment - GitHub - opengeos/leafmap: A Python package for interactive mapping and geospatial a...

---

<div class="post-metadata">

**Author:** ![cboettig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/cboettig/32/1788_2.png) [@cboettig](https://discourse.pangeo.io/u/cboettig)\
**Post date:** [May 4, 2023, 3:40pm UTC](https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416/3 "2023-05-04T15:40:44Z")

</div>

perfect, thanks! yup, this issue appears specific to ipyleaflet driver in leafmap that is [frequently reported](https://github.com/jupyter-widgets/ipyleaflet/issues?q=is%3Aissue+Jupyter+error+displaying+widget%3A+model+not+found), the other javascript drivers are working fine. Haven’t resolved it yet (no luck with previously reported solutions, which are a bit dated), but will follow up there.

---

<div class="post-metadata">

**Author:** ![Donte](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Donte](https://discourse.pangeo.io/u/Donte)\
**Post date:** [April 11, 2024, 9:18pm UTC](https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416/4 "2024-04-11T21:18:38Z")

</div>

@cboettig Did you find a solution to this issue?

---

<div class="post-metadata">

**Author:** ![cboettig](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/cboettig/32/1788_2.png) [@cboettig](https://discourse.pangeo.io/u/cboettig)\
**Post date:** [April 12, 2024, 3:44am UTC](https://discourse.pangeo.io/t/unable-to-view-leaflet-javascript-on-self-hosted-jupyterlab-instance/3416/5 "2024-04-12T03:44:01Z")

</div>

Thanks for following up, it has all been working well for me for some time now. It’s possible my previous issues were related to a bad mix of python dependencies (including jupyter itself) with some installed from pip and others installed from conda. I tend to do pure pip or pure conda based setups now. but that’s just a guess, I haven’t replicated the failed condition. I enjoy several of the different drivers in leafmap, all work well in jupyter and I recommend them.

(Aside, I have seen some leafmap layer types not rendering correctly in code-server, though definitely a separate issue as the base leafmap works fine).
