jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.47k stars 361 forks source link

error when saving to HTML in JupyterLab 4 #1137

Open rodrigo-j-goncalves opened 10 months ago

rodrigo-j-goncalves commented 10 months ago

When I try to save a map using JupyterLab 4.0.5 I get error. However if I install the extension (which is suppose to be appropriate for JupyterLab <= 2) I get rid of the error. See more details here

kloczek commented 10 months ago

Looks like generally ipyleaflet is not yet ready for jupyterlab 4.x because it has pinned jupyterlab 4.x on build stage

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
running egg_info
creating ipyleaflet.egg-info
writing ipyleaflet.egg-info/PKG-INFO
writing dependency_links to ipyleaflet.egg-info/dependency_links.txt
writing requirements to ipyleaflet.egg-info/requires.txt
writing top-level names to ipyleaflet.egg-info/top_level.txt
writing manifest file 'ipyleaflet.egg-info/SOURCES.txt'
reading manifest file 'ipyleaflet.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
<string>:38: DeprecatedWarning: create_cmdclass is deprecated as of 0.8 and will be removed in 1.0. "
Use `wrap_installers` to handle prebuild steps in cmdclass.
Use `get_data_files` to handle data files.
Use `include_package_data=True` and `MANIFEST.in` for package data.

<string>:40: DeprecatedWarning: install_npm is deprecated as of 0.8 and will be removed in 1.0. Use `npm_builder` and `wrap_installers`
/usr/lib/python3.8/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
!!

        ********************************************************************************
        The license_file parameter is deprecated, use license_files instead.

        By 2023-Oct-30, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
        ********************************************************************************

!!
  parsed = self.parsers.get(option_name, lambda x: x)(value)
warning: no files found matching '*.*' under directory 'ipyleaflet/nbextension'
warning: no files found matching '*.*' under directory 'ipyleaflet/labextension'
warning: no previously-included files found matching 'ipyleaflet/labextension/static/*.js.LICENSE.txt'
warning: no previously-included files found matching 'ipyleaflet/nbextension/*.js.LICENSE.txt'
adding license file 'LICENSE'
writing manifest file 'ipyleaflet.egg-info/SOURCES.txt'

ERROR Missing dependencies:
        jupyterlab<4,>=3.0.0
martinRenou commented 10 months ago

Thank you for opening an issue. Looking at the error traceback, I don't think this has to do with JupyterLab 4 at all.

File ~/.virtualenvs/VirtEnvRG002_geo/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:609, in Widget.get_state(self, key, drop_defaults)
    607 for k in keys:
    608     to_json = self.trait_metadata(k, 'to_json', self._trait_to_json)
--> 609     value = to_json(getattr(self, k), self)
    610     if not drop_defaults or not self._compare(value, traits[k].default_value):
    611         state[k] = value

File ~/.virtualenvs/VirtEnvRG002_geo/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:54, in _widget_to_json(x, obj)
     52     return [_widget_to_json(v, obj) for v in x]
     53 elif isinstance(x, Widget):
---> 54     return "IPY_MODEL_" + x.model_id
     55 else:
     56     return x

File ~/.virtualenvs/VirtEnvRG002_geo/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:546, in Widget.model_id(self)
    541 @property
    542 def model_id(self):
    543     """Gets the model id of this widget.
    544 
    545     If a Comm doesn't exist yet, a Comm will be created automagically."""
--> 546     return self.comm.comm_id

AttributeError: 'NoneType' object has no attribute 'comm_id'

This looks a lot like it has to do with the recent changes in ipywidgets regarding the comm creation. I can try to have a deeper look someday.

Looks like generally ipyleaflet is not yet ready for jupyterlab 4.x because it has pinned jupyterlab 4.x on build stage

ipyleaflet works with JupyterLab 4.x. It just does not build against it yet.

giswqs commented 10 months ago

JupyterLab 4.x does not work properly with ipyleaflet yet. Just be aware

https://github.com/jupyter-widgets/ipyleaflet/issues/1125

jhgoebbert commented 8 months ago

I came across this fork which claims to run with JupyterLab>4. Perhaps it is possible to merge the commits from there.
https://github.com/cdanielw/ipyleaflet

jhgoebbert commented 8 months ago

https://github.com/jupyter-widgets/ipyleaflet/issues/1125#issuecomment-1823987231

jhgoebbert commented 8 months ago

https://github.com/jupyter-widgets/ipyleaflet/pull/1146