> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-wbdocs-1882.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Why does my training hang with distributed training?

There are two common reasons training hangs when using W\&B with distributed training:

1. **Hanging at the beginning of training**: W\&B's multiprocessing can interfere with the multiprocessing from distributed training frameworks.
2. **Hanging at the end of training**: The W\&B process does not know when it needs to exit.

## Fix hanging at the start

Enable W\&B Service, which is the default for W\&B SDK `0.13.0` and above. If you are on an older version, upgrade your SDK:

```shell theme={null}
pip install --upgrade wandb
```

For W\&B SDK `0.12.5` through `0.12.x`, enable W\&B Service explicitly:

```python theme={null}
def main():
    wandb.require("service")
    # rest of your script
```

For W\&B SDK `0.12.4` and below, set the `WANDB_START_METHOD` environment variable:

```bash theme={null}
export WANDB_START_METHOD=thread
```

## Fix hanging at the end

Call `wandb.finish()` at the end of your training script to tell W\&B that the run is complete:

```python theme={null}
wandb.finish()
```

This ensures all data is uploaded and the W\&B process exits cleanly.

For more information, see [Distributed training](/models/track/log/distributed-training/).

***

<Badge stroke shape="pill" color="orange" size="md">[Experiments](/support/models/tags/experiments)</Badge><Badge stroke shape="pill" color="orange" size="md">[Run Crashes](/support/models/tags/run-crashes)</Badge>
