spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

Deprecated IPython.core.display

Open reonokiy opened this issue 4 months ago • 1 comments

According to the IPython docs(https://ipython.readthedocs.io/en/stable/whatsnew/version7.html#pending-deprecated-imports), IPython.core.display was deprecated in IPython 7.14 and should be replace by IPython.display.

How to reproduce the behaviour

example code in jupyter:

import spacy
from spacy import displacy

nlp = spacy.load("en_core_web_sm")
doc = nlp("Apple is looking at buying U.K. startup for $1 billion")
displacy.render(doc, style="ent", jupyter=True)

error message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[2], line 6
      4 nlp = spacy.load("en_core_web_sm")
      5 doc = nlp("Apple is looking at buying U.K. startup for $1 billion")
----> 6 displacy.render(doc, style="ent", jupyter=True)

File ~/.local/share/mamba/envs/spacy-test/lib/python3.12/site-packages/spacy/displacy/__init__.py:69, in render(docs, style, page, minify, jupyter, options, manual)
     65     html = RENDER_WRAPPER(html)
     66 if jupyter or (jupyter is None and is_in_jupyter()):
     67     # return HTML rendered by IPython display()
     68     # See #4840 for details on span wrapper to disable mathjax
---> 69     from IPython.core.display import HTML, display
     71     return display(HTML('<span class="tex2jax_ignore">{}</span>'.format(html)))
     72 return html

ImportError: cannot import name 'display' from 'IPython.core.display'

Your Environment

  • Operating System: WSL
  • Python Version Used: 3.12
  • spaCy Version Used: 3.8.7
  • Environment Information:
    • ipython version: 9.4.0

reonokiy avatar Aug 22 '25 06:08 reonokiy

This issue is fixed by PR #13865 (merged)

weezymatt avatar Dec 02 '25 09:12 weezymatt