diff --git a/conf.py b/conf.py index 7401bdcea2..1011fca60c 100644 --- a/conf.py +++ b/conf.py @@ -85,7 +85,10 @@ def wrapper(*args, **kwargs): raise RuntimeError(f"Error in subprocess: {result}") return wrapper -sphinx_gallery.gen_rst.generate_file_rst = call_in_subprocess(sphinx_gallery.gen_rst.generate_file_rst) +# Windows does not support multiprocessing with fork and mac has issues with +# fork so we do not monkey patch sphinx gallery to run in subprocesses. +if os.getenv("TUTORIALS_ISOLATE_BUILD", "1") == "1" and not sys.platform.startswith("win") and not sys.platform == "darwin": + sphinx_gallery.gen_rst.generate_file_rst = call_in_subprocess(sphinx_gallery.gen_rst.generate_file_rst) try: import torchvision