Skip to content

Fix: Update display import for compatibility with latest IPython Fixes: #13763 #13787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rnihesh
Copy link

@rnihesh rnihesh commented Apr 4, 2025

Fix: Update display import for compatibility with latest IPython


Description

This PR updates the import statement in displacy.render() to fix an ImportError caused by breaking changes in IPython 9+.

Replaced:

from IPython.core.display import HTML, display

With:

from IPython.display import HTML, display

The display function is no longer available in IPython.core.display in IPython 9 and above. This change ensures displacy.render() works correctly in Jupyter and notebook environments using newer versions of IPython.

Tested in:

  • Python 3.12.9 (venv)
  • IPython 9.0.2
  • JupyterLab
  • Confirmed displacy.render() now works without error.

Types of change

  • Bug fix

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

Fixes: #13763

@rnihesh rnihesh changed the title Fix: Update display import for compatibility with latest IPython Fix: Update display import for compatibility with latest IPython Fix: 13763 Apr 4, 2025
@rnihesh rnihesh changed the title Fix: Update display import for compatibility with latest IPython Fix: 13763 Fix: Update display import for compatibility with latest IPython Fixes: #13763 Apr 4, 2025
@majorgilles
Copy link

also ran into this issue, was about to submit my own PR

@ines
Copy link
Member

ines commented May 12, 2025

Thanks a lot and sorry for only getting to this now!

Just wondering if we should include a try/except here for backwards compatibility, even though it's not very pretty. Because I wouldn't want users on older IPython versions to run into problems going forward. This is probably the one thing I would add and then we can ship this (happy to do it before we release or you can also make an update) 🙂

@ines ines added bug Bugs and behaviour differing from documentation third-party Third-party packages and services feat / visualizers Feature: Built-in displaCy and other visualizers labels May 12, 2025
@rnihesh
Copy link
Author

rnihesh commented May 12, 2025

Yup working on that

@rnihesh
Copy link
Author

rnihesh commented May 12, 2025

done fixed

@celestinoxp
Copy link

@ines ping...

@wildfluss
Copy link

this is very annoying especially when working with prodigy :/ had to patch version which prodigy pulls etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and behaviour differing from documentation feat / visualizers Feature: Built-in displaCy and other visualizers third-party Third-party packages and services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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