{"record":{"id":"022ca51dd8dff2ec","repo":"Lightning-AI/pytorch-lightning","slug":"the-start-method-self-start-method-is-not-ava","errorCode":null,"errorMessage":"The start method '{self._start_method}' is not available on this platform. Available methods are: {', '.join(mp.get_all_start_methods())}","messagePattern":"The start method '(.+?)' is not available on this platform\\. Available methods are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/strategies/launchers/multiprocessing.py","lineNumber":71,"sourceCode":"    Args:\n        strategy: A reference to the strategy that is used together with this launcher.\n        start_method: The method how to start the processes.\n            - 'spawn': The default start method. Requires all objects to be pickleable.\n            - 'fork': Preferable for IPython/Jupyter environments where 'spawn' is not available. Not available on\n              the Windows platform for example.\n            - 'forkserver': Alternative implementation to 'fork'.\n\n    \"\"\"\n\n    def __init__(\n        self,\n        strategy: \"ParallelStrategy\",\n        start_method: Literal[\"spawn\", \"fork\", \"forkserver\"] = \"spawn\",\n    ) -> None:\n        self._strategy = strategy\n        self._start_method = start_method\n        if start_method not in mp.get_all_start_methods():\n            raise ValueError(\n                f\"The start method '{self._start_method}' is not available on this platform. Available methods are:\"\n                f\" {', '.join(mp.get_all_start_methods())}\"\n            )\n\n    @property\n    @override\n    def is_interactive_compatible(self) -> bool:\n        # The start method 'spawn' is not supported in interactive environments\n        # The start method 'fork' is the only one supported in Jupyter environments, with constraints around CUDA\n        # initialization. For more context, see https://github.com/Lightning-AI/pytorch-lightning/issues/7550\n        return self._start_method == \"fork\"\n\n    @override\n    def launch(self, function: Callable, *args: Any, **kwargs: Any) -> Any:\n        \"\"\"Launches processes that run the given function in parallel.\n\n        The function is allowed to have a return value. However, when all processes join, only the return value\n        of worker process 0 gets returned from this `launch` method in the main process.","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/strategies/launchers/multiprocessing.py#L53-L89","documentation":"The _MultiProcessingLauncher validates its start_method argument against multiprocessing.get_all_start_methods() at construction time. Not all platforms support all start methods: 'forkserver' and 'fork' are Unix-only, and 'fork' is unavailable on macOS spawn-default setups that restrict it. Passing an unsupported method raises this ValueError immediately.","triggerScenarios":"Creating a strategy/launcher with launcher('forkserver') or _MultiProcessingLauncher(strategy, start_method='forkserver') on Windows, or a start method filtered out by the platform's mp.get_all_start_methods().","commonSituations":"Running a script developed on Linux under Windows; explicitly setting start_method in Fabric/strategy kwargs that is not supported by the OS; CI matrix runs on Windows hitting Unix-only start methods.","solutions":["Switch to start_method='spawn', which is available on all platforms","Remove the explicit start_method argument to use the default ('spawn')","On Windows, accept that only 'spawn' is generally available and adapt the code to be spawn-safe (guard main, picklable objects)"],"exampleFix":"# before\nlauncher = _MultiProcessingLauncher(strategy, start_method=\"forkserver\")\n\n# after\nimport multiprocessing as mp\nmethod = \"forkserver\" if \"forkserver\" in mp.get_all_start_methods() else \"spawn\"\nlauncher = _MultiProcessingLauncher(strategy, start_method=method)","handlingStrategy":"validation","validationCode":"import multiprocessing as mp\nallowed = mp.get_all_start_methods()\nif start_method not in allowed:\n    start_method = \"spawn\"  # universally available fallback","typeGuard":"def safe_start_method(m: str) -> Literal[\"spawn\", \"fork\", \"forkserver\"]:\n    import multiprocessing as mp\n    return m if m in mp.get_all_start_methods() else \"spawn\"  # type: ignore[return-value]","tryCatchPattern":null,"preventionTips":["Never hardcode 'fork'/'forkserver' in cross-platform scripts","Check mp.get_all_start_methods() in config validation or CLI arg parsing"],"tags":["pytorch-lightning","multiprocessing","platform","start-method","windows"],"backgroundTag":"unsupported-platform-start-method","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}