Skip to content

Commit 74002b3

Browse files
committed
tc
1 parent 2f4e5c3 commit 74002b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def call_fn(func, args, kwargs, result_queue):
7171

7272
def call_in_subprocess(func):
7373
def wrapper(*args, **kwargs):
74+
multiprocessing.set_start_method("fork", force=True)
7475
result_queue = multiprocessing.Queue()
7576
p = multiprocessing.Process(
7677
target=call_fn,
@@ -85,7 +86,10 @@ def wrapper(*args, **kwargs):
8586
raise RuntimeError(f"Error in subprocess: {result}")
8687
return wrapper
8788

88-
sphinx_gallery.gen_rst.generate_file_rst = call_in_subprocess(sphinx_gallery.gen_rst.generate_file_rst)
89+
# Windows does not support multiprocessing with fork, so we do not monkey patch
90+
# sphinx gallery to run in subprocesses.
91+
if os.getenv("TUTORIALS_ISOLATE_BUILD", "1") == "1" and not sys.platform.startswith("win"):
92+
sphinx_gallery.gen_rst.generate_file_rst = call_in_subprocess(sphinx_gallery.gen_rst.generate_file_rst)
8993

9094
try:
9195
import torchvision

0 commit comments

Comments
 (0)