Install from PyPI¶
leafmap is available on PyPI. To install leafmap, run this command in your terminal:
Install from conda-forge¶
The leafmap package has an optional dependency - geopandas, which can be challenging to install on some computers, especially Windows. It is highly recommended that you create a fresh conda environment to install geopandas and leafmap. Follow the commands below to set up a conda env and isntall geopandas, xarray_leaflet, and leafmap.
1 2 3 4 5 6
Optionally, you can install some Jupyter notebook extensions, which can improve your productivity in the notebook environment. Some useful extensions include Table of Contents, Gist-it, Autopep8, Variable Inspector, etc. See this post for more information.
Install from GitHub¶
To install the development version from GitHub using Git, run the following command in your terminal:
If you have installed leafmap before and want to upgrade to the latest version, you can run the following command in your terminal:
If you use conda, you can update leafmap to the latest version by running the following command in your terminal:
To install the development version from GitHub directly within Jupyter notebook without using Git, run the following code:
If the interactive map does not show up on Jupyter Notebook and JupyterLab, it is probably because the ipyleaflet extentsion is not installed properly.
For example, you might receive an error message saying
Error displaying widget: model not found. This a well-known issue related to ipyleaflet. See some relevant issues below.
- How to display map object using ipyleaflet in jupyter notebook or jupyter Lab
- ipyleaflet does not work in jupyter lab - "Error displaying widget: model not found"
- Error displaying widget: model not found
Try some of the options below to resolve the issue. If the issue persists after trying these steps, you can open an issue on the ipyleaflet repository.
For Jupyter notebook, try running the following two commands within your leafmap conda environment:
For JupyterLab, try running the following command within your leafmap conda environment:
Alternatively, you can run leafmap directly using binder: