arcgis-python-api icon indicating copy to clipboard operation
arcgis-python-api copied to clipboard

JupyterLab Extension Browser Installs v1.8.1 instead of v2.0.0 (looks like Impossible Ver Requirement)

Open spick002 opened this issue 2 years ago • 4 comments

Describe the bug JupyterLab Extension Browser Installs v1.8.1 instead of v2.0.0, causing incompatibility with new v2.0.0 installed via pip3 install arcGIS. I think there might be some script on git here causing it to download v1.8.1 vs v2.0.0

To Reproduce attempt to install arcGIS extension through JupyterLabs v3.2.9 gui on left hand side Proving I have 3.2.9: image

Causes simplest of scripts such as:

import arcgis
gis = arcgis.GIS()
map=gis.map()
map 

to produce error: image

error: cannot use arcgis in JupyterLabs (installs wrong version)

image

Expected behavior Installation of v2.0.0

Platform (please complete the following information):

  • OS: Win 10 (JupyterLabs within Anaconda 3)
  • Browser: Chrome
  • Python API Version: 1.8.1/2.0.0

Edit:

I tried forcing a widget version download in terminal and it looks like 2.0.0 requires jupyterlab 3.3.0 or above: image

That's troubling because the latest version on jupyterlab git is 3.2.9: image

If this is true, can the 3.0.0 requirement be rolled back to 3.2.9 at the very least? Thank you!

spick002 avatar Mar 01 '22 01:03 spick002

Hi @spick002 Have you tried removing the arcgis package, and remove the previous existing env first, before pip or conda install arcgis api for python 2.0? I have tried using conda and pip install on my end (with brand new env, and fresh arcgis package installed), the arcgis package I get is 2.0.0, and my jupyter lab env is 3.2.9.

CMPeng avatar Mar 04 '22 00:03 CMPeng

However, with pip3 installing arcgis on my side, I do see a widget failure when doing gis.map(), and my error message was some what different from what's logged here, say -

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_62676/1618960627.py in <module>
----> 1 gis.map()

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\arcgis\gis\__init__.py in map(self, location, zoomlevel, mode, geocoder)
   1323             mapwidget = MapView(gis=self, item=location, mode=mode)
   1324         else:
-> 1325             mapwidget = MapView(gis=self, mode=mode)
   1326 
   1327             # Geocode the location

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\arcgis\widgets\_mapview\_mapview.py in __init__(self, gis, item, mode, **kwargs)
    898         item    web map item from portal with which to initialize the map widget
    899         """
--> 900         super(MapView, self).__init__(**kwargs)
    901         self._uuid = str(uuid4())
    902 

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\ipywidgets\widgets\widget.py in __init__(self, **kwargs)
    413 
    414         Widget._call_widget_constructed(self)
--> 415         self.open()
    416 
    417     def __del__(self):

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\ipywidgets\widgets\widget.py in open(self)
    436                 args['comm_id'] = self._model_id
    437 
--> 438             self.comm = Comm(**args)
    439 
    440     @observe('comm')

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\ipykernel\comm\comm.py in __init__(self, target_name, data, metadata, buffers, **kwargs)
     55             if self.primary:
     56                 # I am primary, open my peer.
---> 57                 self.open(data=data, metadata=metadata, buffers=buffers)
     58             else:
     59                 self._closed = False

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\ipykernel\comm\comm.py in open(self, data, metadata, buffers)
     89         comm_manager.register_comm(self)
     90         try:
---> 91             self._publish_msg('comm_open',
     92                               data=data, metadata=metadata, buffers=buffers,
     93                               target_name=self.target_name,

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\ipykernel\comm\comm.py in _publish_msg(self, msg_type, data, metadata, buffers, **keys)
     64         metadata = {} if metadata is None else metadata
     65         content = json_clean(dict(data=data, comm_id=self.comm_id, **keys))
---> 66         self.kernel.session.send(self.kernel.iopub_socket, msg_type,
     67             content,
     68             metadata=json_clean(metadata),

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\jupyter_client\session.py in send(self, stream, msg_or_type, content, parent, ident, buffers, track, header, metadata)
    840         if self.adapt_version:
    841             msg = adapt(msg, self.adapt_version)
--> 842         to_send = self.serialize(msg, ident)
    843         to_send.extend(buffers)
    844         longest = max([len(s) for s in to_send])

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\jupyter_client\session.py in serialize(self, msg, ident)
    714             content = self.none
    715         elif isinstance(content, dict):
--> 716             content = self.pack(content)
    717         elif isinstance(content, bytes):
    718             # content is already packed, as in a relayed message

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\jupyter_client\session.py in json_packer(obj)
     95 def json_packer(obj):
     96     try:
---> 97         return json.dumps(
     98             obj,
     99             default=json_default,

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\json\__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    236         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    237         separators=separators, default=default, sort_keys=sort_keys,
--> 238         **kw).encode(obj)
    239 
    240 

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\json\encoder.py in encode(self, o)
    197         # exceptions aren't as detailed.  The list call should be roughly
    198         # equivalent to the PySequence_Fast that ''.join() would do.
--> 199         chunks = self.iterencode(o, _one_shot=True)
    200         if not isinstance(chunks, (list, tuple)):
    201             chunks = list(chunks)

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\json\encoder.py in iterencode(self, o, _one_shot)
    255                 self.key_separator, self.item_separator, self.sort_keys,
    256                 self.skipkeys, _one_shot)
--> 257         return _iterencode(o, 0)
    258 
    259 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\jupyter_client\jsonutil.py in json_default(obj)
    110     if isinstance(obj, datetime):
    111         obj = _ensure_tzinfo(obj)
--> 112         return obj.isoformat().replace('+00:00', 'Z')
    113 
    114     if isinstance(obj, bytes):

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\dateutil\tz\tz.py in utcoffset(self, dt)
    220             return None
    221 
--> 222         if self._isdst(dt):
    223             return self._dst_offset
    224         else:

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\dateutil\tz\tz.py in _isdst(self, dt, fold_naive)
    289 
    290         # Check for ambiguous times:
--> 291         dstval = self._naive_is_dst(dt)
    292         fold = getattr(dt, 'fold', None)
    293 

~\Anaconda3\envs\python_api_verion2_thru_pip3\lib\site-packages\dateutil\tz\tz.py in _naive_is_dst(self, dt)
    258     def _naive_is_dst(self, dt):
    259         timestamp = _datetime_to_timestamp(dt)
--> 260         return time.localtime(timestamp + time.timezone).tm_isdst
    261 
    262     def _isdst(self, dt, fold_naive=True):

OSError: [Errno 22] Invalid argument

Will further investigate the issue with the team. Thanks @spick002 for reporting the issue.

CMPeng avatar Mar 04 '22 00:03 CMPeng

Hi! Has there be any update on this matter? I have the same problem.

ntokoven avatar Oct 19 '22 19:10 ntokoven

The map widget is currently not supported in Jupyter Labs, this is something we are working on and hope to have in future releases.

nanaeaubry avatar Dec 19 '22 16:12 nanaeaubry