Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 7b1818e

Browse files
committed
preemptively import orjson
without this, in mode="jupyterlab" we see (sometimes): AttributeError: partially initialized module 'orjson' has no attribute 'OPT_SORT_KEYS' (most likely due to a circular import)
1 parent 75d6563 commit 7b1818e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

jupyter_dash/jupyter_app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,14 @@ def run_server(
287287
inline_exceptions=inline_exceptions,
288288
)
289289

290+
# prevent partial import of orjson when it's installed and mode=jupyterlab
291+
# TODO: why do we need this? Why only in this mode? Importing here in
292+
# all modes anyway, in case there's a way it can pop up in another mode
293+
try:
294+
import orjson
295+
except ImportError:
296+
pass
297+
290298
@retry(
291299
stop_max_attempt_number=15,
292300
wait_exponential_multiplier=100,

0 commit comments

Comments
 (0)