Lightning-AI/pytorch-lightning · error · ValueError
The start method '{self._start_method}' is not available on
Error message
The start method '{self._start_method}' is not available on this platform. Available methods are: {', '.join(mp.get_all_start_methods())} What it means
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.
Source
Thrown at src/lightning/fabric/strategies/launchers/multiprocessing.py:71
Args:
strategy: A reference to the strategy that is used together with this launcher.
start_method: The method how to start the processes.
- 'spawn': The default start method. Requires all objects to be pickleable.
- 'fork': Preferable for IPython/Jupyter environments where 'spawn' is not available. Not available on
the Windows platform for example.
- 'forkserver': Alternative implementation to 'fork'.
"""
def __init__(
self,
strategy: "ParallelStrategy",
start_method: Literal["spawn", "fork", "forkserver"] = "spawn",
) -> None:
self._strategy = strategy
self._start_method = start_method
if start_method not in mp.get_all_start_methods():
raise ValueError(
f"The start method '{self._start_method}' is not available on this platform. Available methods are:"
f" {', '.join(mp.get_all_start_methods())}"
)
@property
@override
def is_interactive_compatible(self) -> bool:
# The start method 'spawn' is not supported in interactive environments
# The start method 'fork' is the only one supported in Jupyter environments, with constraints around CUDA
# initialization. For more context, see https://github.com/Lightning-AI/pytorch-lightning/issues/7550
return self._start_method == "fork"
@override
def launch(self, function: Callable, *args: Any, **kwargs: Any) -> Any:
"""Launches processes that run the given function in parallel.
The function is allowed to have a return value. However, when all processes join, only the return value
of worker process 0 gets returned from this `launch` method in the main process.View on GitHub (pinned to 9fed5c27d2)
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)
Example fix
# before launcher = _MultiProcessingLauncher(strategy, start_method="forkserver") # after import multiprocessing as mp method = "forkserver" if "forkserver" in mp.get_all_start_methods() else "spawn" launcher = _MultiProcessingLauncher(strategy, start_method=method)
Defensive patterns
Strategy: validation
Validate before calling
import multiprocessing as mp
allowed = mp.get_all_start_methods()
if start_method not in allowed:
start_method = "spawn" # universally available fallback Type guard
def safe_start_method(m: str) -> Literal["spawn", "fork", "forkserver"]:
import multiprocessing as mp
return m if m in mp.get_all_start_methods() else "spawn" # type: ignore[return-value] Prevention
- Never hardcode 'fork'/'forkserver' in cross-platform scripts
- Check mp.get_all_start_methods() in config validation or CLI arg parsing
When it happens
Trigger: 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().
Common situations: 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.
Related errors
- The start method '{self._start_method}' is not available on
- Cannot re-initialize CUDA in forked subprocess. To use CUDA
- Lightning can't create new processes if CUDA is already init
- Launching multiple processes with the 'spawn' start method r
- You selected `Trainer(strategy='{strategy_flag}')` but proce
AI-assisted analysis of Lightning-AI/pytorch-lightning@9fed5c27d2 (2026-08-28).
Data as JSON: /api/errors/022ca51dd8dff2ec.
Report an issue: GitHub.