From 372ac6044149ba0304f0f34276d2c3a9ba370ebf Mon Sep 17 00:00:00 2001 From: Nihesh Rachakonda Date: Mon, 12 May 2025 16:38:48 +0530 Subject: [PATCH] Fix with Try/Except for older versions --- spacy/displacy/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/displacy/__init__.py b/spacy/displacy/__init__.py index 032c27ce7..f7466bbb8 100644 --- a/spacy/displacy/__init__.py +++ b/spacy/displacy/__init__.py @@ -66,7 +66,10 @@ def render( if jupyter or (jupyter is None and is_in_jupyter()): # return HTML rendered by IPython display() # See #4840 for details on span wrapper to disable mathjax - from IPython.display import HTML, display + try: + from IPython.display import HTML, display + except ImportError: + from IPython.core.display import HTML, display return display(HTML('{}'.format(html))) return html