Skip to content

Commit

Permalink
Fixing issue with autoloading of ipython extension
Browse files Browse the repository at this point in the history
  • Loading branch information
max-radin committed Jul 18, 2024
1 parent 9f94d85 commit 493a0c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/benchq/compilation/graph_states/initialize_julia.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any

import juliapkg
Expand Down Expand Up @@ -52,6 +53,13 @@

juliapkg.resolve()

# Disable autoloading of the IPython extension unless the user explicitly requests it.
# Context: if IPython.display.set_matplotlib_formats has been called, then the
# autoloading of the IPython extension seems to cause the program to exit or hang. (The
# set_matplotlib_formats function gets called, for example, when certain pyLIQTR modules
# are imported.)
if "PYTHON_JULIACALL_AUTOLOAD_IPYTHON_EXTENSION" not in os.environ:
os.environ["PYTHON_JULIACALL_AUTOLOAD_IPYTHON_EXTENSION"] = "no"

# Put this import second because it can install julia automatically and we don't
# want to install julia twice if the julia version that juliacall finds is different
Expand Down

0 comments on commit 493a0c5

Please sign in to comment.