I'm still learning ArcGIS, but I immediately came upon an issue while trying to get everything set up. This is from the very first tutorial, as well.
The code is very simple. It simply displays a map.
from arcgis.gis import GIS
gis = GIS()
m = gis.map()
m
However, I'm getting an error message from this code.
FWIW, I installed everything using pip, and I'm in the virtualenvironment that everything was installed into using a jupyter notebook and vs code. I tried it in jupyter lab, just to make sure, but I got the same error.
AttributeError Traceback (most recent call last)
File c:\Users\AlastorBloode\SpanWalker App\ent\lib\site-packages\IPython\core\formatters.py:920, in IPythonDisplayFormatter.__call__(self, obj)
918 method = get_real_method(obj, self.print_method)
919 if method is not None:
--> 920 method()
921 return True
File c:\Users\AlastorBloode\SpanWalker App\ent\lib\site-packages\arcgis\widgets\_mapview\_mapview.py:948, in MapView._ipython_display_(self)
942 """Override the parent ipython display function that is called
943 whenever is displayed in the notebook. Display a blank area
944 below the map widget that can be controlled via a display handler
945 set to self._preview_image_display_handler.
946 """
947 self._setup_gis_properties(self.gis)
--> 948 super(MapView, self)._ipython_display_()
949 self._preview_image_display_handler = display(
950 HTML(self._assemble_img_preview_html_str("")),
951 display_id="preview-" + str(self._uuid),
952 )
953 self._preview_html_embed_display_handler = display(
954 HTML(self._assemble_html_embed_html_str("")),
955 display_id="preview-html-" + str(self._uuid),
956 )
AttributeError: 'super' object has no attribute '_ipython_display_'
I'm not sure how to fix it, or if it's a known bug or if I'm just making some mistake somewhere, but any help would be highly appreciated.
I also tried to do the same thing. I installed ipywidgets like the following, but I still had issues with arcgis-map-ipywidget. Apparently Jupyter Notebook introduced a breaking change, and we need to downgrade our versions. I'll link a similar github issue at the bottom.
install_requires=[ 'ipywidgets>=7.6.0,<8' ],
Thank you for sharing this - I was running into the same issue. I did a `pip uninstall ipywidgets` and then a `pip install ipywidgets==7.6.0` and restarted my notebook and no longer running into the error. (NOTE: I dont use ARGGIS Pro, my environment is native python3.9 venv with installed module arcgis==2.1.0)
Having the same issue and keen on finding a solution 🙂
When using m.embed() instead, I do not get the error above
AttributeError: 'super' object has no attribute '_ipython_display_'
but an error on the following line instead (949 as per the code above)
AttributeError: 'MapView' object has no attribute '_preview_image_display_handler'
This issue is also discussed here: https://community.esri.com/t5/arcgis-online-questions/mapview-object-has-no-attribute-preview-image/...
Ok so I managed to solve this issue by:
Now I have a new issue related to numpy though:
AttributeError: module 'numpy' has no attribute 'str'
The Numpy error was solved by replacing instances of np.str and np.int (will be deprecated soon) in the _accessor.py file, see https://community.esri.com/t5/arcgis-pro-questions/attributeerror-module-numpy-has-no-attribute-str/....
For the m.embed() code, I think the the map should have been generated at least once before being embedded. This removed the "MapView" error for me.