{"id":7314,"library":"ipyleaflet","title":"ipyleaflet","description":"ipyleaflet is a Jupyter widget for Leaflet.js, enabling the creation of interactive maps directly within Jupyter Notebook and JupyterLab environments. It currently stands at version 0.20.0 and maintains an active development pace with several releases throughout the year, adding new features and addressing bugs.","status":"active","version":"0.20.0","language":"en","source_language":"en","source_url":"https://github.com/jupyter-widgets/ipyleaflet","tags":["jupyter","leaflet","map","gis","widgets","interactive","geospatial"],"install":[{"cmd":"pip install ipyleaflet","lang":"bash","label":"Basic Installation"},{"cmd":"jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet","lang":"bash","label":"JupyterLab Extension (for JupyterLab <=2)"}],"dependencies":[{"reason":"ipyleaflet is built upon ipywidgets for interactive functionality in Jupyter environments.","package":"ipywidgets","optional":false},{"reason":"Requires Python 3.8 or higher.","package":"Python","optional":false}],"imports":[{"symbol":"Map","correct":"from ipyleaflet import Map"},{"symbol":"Marker","correct":"from ipyleaflet import Marker"},{"symbol":"TileLayer","correct":"from ipyleaflet import TileLayer"},{"symbol":"basemaps","correct":"from ipyleaflet import basemaps"},{"symbol":"DrawControl","correct":"from ipyleaflet import DrawControl"},{"symbol":"FullScreenControl","correct":"from ipyleaflet import FullScreenControl"},{"note":"jupyter-leaflet is the npm package (frontend component), not the Python package to import.","wrong":"import jupyter_leaflet","symbol":"jupyter_leaflet","correct":"from ipyleaflet import Map"}],"quickstart":{"code":"from ipyleaflet import Map, Marker\n\n# Create a map centered at a specific location\nm = Map(center=(52.204793, 0.121558), zoom=10)\n\n# Add a marker\nmarker = Marker(location=(52.204793, 0.121558), draggable=True)\nm.add_layer(marker)\n\n# Display the map (in Jupyter environment)\nm","lang":"python","description":"This quickstart demonstrates how to create a basic interactive map and add a draggable marker using ipyleaflet within a Jupyter environment."},"warnings":[{"fix":"Upgrade ipyleaflet to version 0.18.0 or newer: `pip install --upgrade ipyleaflet`.","message":"Older versions of ipyleaflet (pre-0.18.0) experienced issues with JupyterLab 4.x, where map attributes like zoom or center would not update. This was addressed in version 0.18.0.","severity":"breaking","affected_versions":"<0.18.0"},{"fix":"Replace `map.add_layer(layer)` with `map.add(layer)` and `map.add_control(control)` with `map.add(control)`.","message":"The `add_control()` and `add_layer()` methods on the Map object were deprecated in version 0.17.0. Users should now use the more general `add()` method.","severity":"deprecated","affected_versions":">=0.17.0"},{"fix":"For Jupyter Notebook, run `jupyter nbextension enable --py --sys-prefix ipyleaflet`. For JupyterLab <=2, run `jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet`.","message":"For older Jupyter Notebook versions (prior to 5.3) or JupyterLab <=2, manual installation of the Jupyter extension might be required. Failure to do so can result in widgets not displaying.","severity":"gotcha","affected_versions":"<0.19.2 (for nbextension note), <=2 (for JupyterLab)"},{"fix":"Explicitly set the `zoom` parameter when initializing `Map()` if a specific initial zoom level is desired, e.g., `m = Map(zoom=12)`.","message":"The default zoom level for a newly created `Map()` object changed from 12 to 4 in version 0.20.0, potentially affecting existing code or expectations for initial map views.","severity":"gotcha","affected_versions":">=0.20.0"},{"fix":"Use a local Jupyter environment (Jupyter Notebook, JupyterLab) or a service like Binder instead of Google Colab for ipyleaflet. Libraries like `leafmap` automatically switch to `folium` in Colab.","message":"ipyleaflet does not currently work in Google Colab due to limitations with ipywidgets integration in that environment, and maps will not display.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure `ipyleaflet` is installed correctly. For Jupyter Notebook, try `jupyter nbextension enable --py --sys-prefix ipyleaflet`. For JupyterLab, try `jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet` (for older versions of Lab).","cause":"The ipyleaflet Jupyter extension is not properly installed or enabled, preventing the frontend from rendering the widget. This is a common issue.","error":"Error displaying widget: model not found"},{"fix":"Upgrade ipyleaflet to version 0.18.0 or newer: `pip install --upgrade ipyleaflet`.","cause":"This issue was prevalent in ipyleaflet versions prior to 0.18.0 when used with JupyterLab 4.x due to compatibility problems.","error":"Map attributes (e.g., zoom, center) do not update in JupyterLab."},{"fix":"Restart the Jupyter kernel. Verify the extension is enabled (see 'Error displaying widget' fix). Confirm you are not running in Google Colab. If using an older JupyterLab, ensure the labextension is installed.","cause":"This can happen if the widget state isn't correctly saved or the kernel is no longer available. Often points to an underlying installation or environment issue, or running in an unsupported environment like Google Colab.","error":"Map does not display anything, no error message, just empty output."}]}