BUG
The MapView widget fails to display in Jupyter Notebooks hosted within ArcGIS Pro when run inside a Jupyter Notebook. The ArcGIS API for Python has an interactive map widget that allows visualization of maps, spatial data, and more. This map widget is normally created via gis.map() , arcgis.widgets.MapView(), and arcgis.mapping.WebMap().
When running a Jupyter Notebook on a computer over http, the interactive map widget fails to load properly in some browsers. This map widget loads the ArcGIS API for JavaScript from js.arcgis.com, which recently enforced HSTS standards (HTTPS only). BUG-000136038 is associated with this issue.
The image below shows the Jupyter Notebook MapView() widget displaying an error in ArcGIS Pro.
The Python API for Python redirects to an HTTP URL that no longer functions after the update.
If errors such as that described above are encountered, update the ArcGIS API for Python to version 1.8.4. This version contains the fix for the map widget not drawing.
To upgrade the arcgis package using Python Package Manager:
The map widget now displays:
Note: In previous versions of this article, and prior to updating the arcgis API, Esri suggested a couple of workarounds to make sure widgets draw. If you used one of the previous workarounds, make sure to undo these:
import os os environ['JSAPI_CDN'] = 'https://js.arcgis.com/4.15/'
from arcgis.widgets import MapView MapView.set_js_cdn('https://js.arcgis.com/4.15/')
Note on older versions of the Python API
Different versions of the Python API target different JS API versions. If running on an older version of Python API, set the JS API CDN to the correct version. Use the table below for reference. The following script displays the Python API version installed:
import arcgis arcgis.__version__
Python API Version | JS API Version |
1.8.4 | 4.15 |
1.8.3 | 4.15 |
1.8.2 | 4.15 |
1.8.1 | 4.15 |
1.8.0 | 4.14 |
1.7.1 | 4.13 |
1.7.0 | 4.13 |
1.6.2 | 4.11 |
1.6.1 | 4.11 |
1.6.0 | 4.10 |
1.5.2 | 4.9 |
1.5.1 | 4.8 |
1.5.0 | 4.8 |
Get help from ArcGIS experts
Download the Esri Support App