Running the following inside the notebook:
!pip install ipyleaflet
!jupyter nbextension enable --py --sys-prefix ipyleaflet
Successfully registers ipyleaflet
extension:
Enabling notebook extension jupyter-leaflet/extension...
- Validating: ok
However rendering the map within the same notebook does not work:
from ipyleaflet import Map, basemaps
Map(
center=(0, 0),
zoom=1,
scroll_wheel_zoom=True,
basemap=basemaps.OpenStreetMap.Mapnik,
)
Error:
[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'LeafletMapModel' from module 'jupyter-leaflet'
Error: Script error for "jupyter-leaflet"
http://requirejs.org/docs/errors.html#scripterror
at makeError (http://localhost:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168:17)
at HTMLScriptElement.onScriptError (http://localhost:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735:36)
Browser says
Refused to execute script from 'http://localhost:8888/static/jupyter-leaflet.js?v=20221102111053' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
The existing solutions to this are upgrading Jupyter notebook to 5.7.7
, but I am using version 6.5.2
.
If I reload the page with the notebook, the ipyleaflet
map shows correctly.
How can I make it work in the first pass?