gee-community/geemap

_set_css_in_cell_output error

giswqs opened this issue · 8 comments

giswqs commented

I created a new conda env and ran geemap in JupyterLab. It throws _set_css_in_cell_output error. It worked fine previously. I guess some recent ipython or JupyterLab updates break this.

conda create -n gee python=3.11
conda activate gee
conda install mamba -c conda-forge
mamba install geemap -c conda-forge

image

giswqs commented

It seems releated to this issue ipython/ipython#14233

giswqs commented

ipython v8.15.0 works fine. So this must have been caused by the recent ipython versions.

image

giswqs commented

@sufyanAbbasi Would you be able to look into this? It seems the _set_css_in_cell_output function is incompatible with the latest ipython release. I tried changing it to this. However, it does not work.

try:
    IPython.get_ipython().events.register("pre_run_cell", _set_css_in_cell_output)
    print('e')
except Exception:
    pass

I got the very same error using the settings below:

  • python 3.11.6
  • windows 11
  • geemap installed through pip
  • error is trigger at the last code line here:
import ee
import geemap.core as geemap

ee.Authenticate()
ee.Initialize()
giswqs commented

Yes, this is an issue caused by the recent ipython releases. geemap needs to update the _set_css_in_cell_output function to make it compatible with the latest ipython. For now, install ipython v8.15.0

pip install ipython==8.15.0
giswqs commented

It turns out that it is an easy fix, thanks to ChatGPT. Simply add the info param to the function solves the issue.

image

Related on Stack Overflow: _set_css_in_cell_output() error in IPython Notebooks

I managed to fix the error at the time (I was the one with the issue in stack) but now the error came back again, both with the old configuration that worked before and also with IPython = 8.20.0 or 8.15.0, geemap = 0.30.4

EDIT: After a bit of installing and reinstalling of the packages I decided to delete the virtual environment I was working in and recreating it and it works now