-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
base: master
Are you sure you want to change the base?
Conversation
also ran into this issue, was about to submit my own PR |
Thanks a lot and sorry for only getting to this now! Just wondering if we should include a |
Yup working on that |
done fixed |
@ines ping... |
this is very annoying especially when working with prodigy :/ had to patch version which prodigy pulls etc |
Temporary solution until this is merged: $ pip install -U "ipython<9" |
@honnibal or someone from spacy team please merge this. Thank you. |
try: | ||
from IPython.display import HTML, display | ||
except ImportError: | ||
from IPython.core.display import HTML, display |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPython maintainer here, the correct import has been from IPython.display import ...
since 2012 (circa IPython 0.13), (or at least it should have been)
And in general you should avoid ImportError (it's unclear why, and use version numbers checking otherwise)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess your docs have been changed, when I raised this PR, I even saw the docs, specifying .core.display
is to be used, can't get the link, but will add a reference here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THe docs are autogenerated, and it's not because an object is defined in IPython.core.display that it should be imported from there.
See how IPython/disaply.py defines
from IPython.core.display import *
https://github.com/ipython/ipython/blob/rel-1.0.0/IPython/display.py#L15
Which (should) makes the .core
unnecessary everywhere.
Also if you have issues with IPython like that, feel free to ping me, I can always re-add the old imports for a few version if it breaks the world. |
Fix: Update display import for compatibility with latest IPython
Description
This PR updates the import statement in
displacy.render()
to fix anImportError
caused by breaking changes in IPython 9+.Replaced:
With:
The
display
function is no longer available inIPython.core.display
in IPython 9 and above. This change ensuresdisplacy.render()
works correctly in Jupyter and notebook environments using newer versions of IPython.Tested in:
displacy.render()
now works without error.Types of change
Checklist
Fixes: #13763