spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

"from IPython.core.display import HTML, display" no more supported for latest IPython

Open ZhihuiLuo opened this issue 9 months ago • 4 comments

Please consider replace from IPython.core.display import HTML, display by from IPython.display import HTML, display.

ZhihuiLuo avatar Mar 04 '25 11:03 ZhihuiLuo

I've Fixed the issue and replaced it.

rnihesh avatar Apr 04 '25 17:04 rnihesh

But there's more behind it. The import from display is only successful when it's realized as a function; display() that inherits the variable that contains the displacy.render-method:

from IPython.display import display, HTML from spacy import displacy import spacy nlp = spacy.load("en_core_web_sm") doc = nlp("This is a test sentence for displaCy visualization.")

sent_exp = displacy.render(doc, style='dep', jupyter=False, options={'distance': 80}) from IPython.display import display, HTML display(HTML(sent_exp))

Else, by just rendering via Displacy without running via display(), the import is conflicting internally with IPython by always trying to import from IPython.core.display.

Meddy92-gif avatar Jul 22 '25 13:07 Meddy92-gif

Yeah true, that was fixed in the other PR waiting for it to be accepted and merged. PR

rnihesh avatar Jul 22 '25 14:07 rnihesh

Hello this issue is fixed by PR https://github.com/explosion/spaCy/pull/13865 (merged)

weezymatt avatar Dec 02 '25 09:12 weezymatt