Register gloo/nccl distributed backends at import time. When PyTorch is installed via emerge (cmake), there is no .dist-info with entry_points metadata. PyTorch 2.15 relies on entry_points or TorchComms for backend registration, so the builtin backends end up unregistered. Call the existing registration functions at module level. --- a/torch/distributed/distributed_c10d.py +++ b/torch/distributed/distributed_c10d.py @@ -1043,6 +1043,15 @@ _backend_type=ProcessGroup.BackendType.XCCL, ) +# Register builtin distributed backends at import time. +# Normally this is done via entry_points (.dist-info) or TorchComms, +# but cmake-installed PyTorch has neither. +if is_gloo_available(): + _register_builtin_gloo_backend() +if is_nccl_available(): + _register_builtin_nccl_backend() + + class BackendConfig: """Backend configuration class."""