Installation¶
Install from PyPI¶
leafmap is available on PyPI. To install leafmap, run this command in your terminal:
1 |
|
Install from conda-forge¶
leafmap is also available on conda-forge. If you have Anaconda or Miniconda installed on your computer, you can install leafmap using the following command:
1 |
|
The leafmap package has some optional dependencies (e.g., geopandas and localtileserver), 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 install geopandas, localtileserver, keplergl, pydeck, and leafmap.
1 2 |
|
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.
1 |
|
Install from GitHub¶
To install the development version from GitHub using Git, run the following command in your terminal:
1 |
|
Use docker¶
You can also use docker to run leafmap:
1 |
|
Upgrade leafmap¶
If you have installed leafmap before and want to upgrade to the latest version, you can run the following command in your terminal:
1 |
|
If you use conda, you can update leafmap to the latest version by running the following command in your terminal:
1 |
|
To install the development version from GitHub directly within Jupyter notebook without using Git, run the following code:
1 2 |
|
Troubleshooting¶
If the interactive map does not show up on Jupyter Notebook and JupyterLab, it is probably because the ipyleaflet extension 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:
1 2 |
|
For JupyterLab, try running the following command within your leafmap conda environment:
1 |
|
Alternatively, you can run leafmap directly using binder: