{"record":{"id":"43b2c0107b1b33d5","repo":"Lightning-AI/pytorch-lightning","slug":"accelerator-cls-qualname-can-not-run-on-yo-43b2c0","errorCode":null,"errorMessage":"`{accelerator_cls.__qualname__}` can not run on your system since the accelerator is not available. The following accelerator(s) is available and can be passed into `accelerator` argument of `Trainer`: {available_accelerator}.","messagePattern":"`(.+?)` can not run on your system since the accelerator is not available\\. The following accelerator\\(s\\) is available and can be passed into `accelerator` argument of `Trainer`: (.+?)\\.","errorType":"validation","errorClass":"MisconfigurationException","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/trainer/connectors/accelerator_connector.py","lineNumber":356,"sourceCode":"            return \"mps\"\n        if CUDAAccelerator.is_available():\n            return \"cuda\"\n        raise MisconfigurationException(\"No supported gpu backend found!\")\n\n    def _set_parallel_devices_and_init_accelerator(self) -> None:\n        if isinstance(self._accelerator_flag, Accelerator):\n            self.accelerator: Accelerator = self._accelerator_flag\n        else:\n            self.accelerator = AcceleratorRegistry.get(self._accelerator_flag)\n        accelerator_cls = self.accelerator.__class__\n\n        if not accelerator_cls.is_available():\n            available_accelerator = [\n                acc_str\n                for acc_str in self._accelerator_types\n                if AcceleratorRegistry[acc_str][\"accelerator\"].is_available()\n            ]\n            raise MisconfigurationException(\n                f\"`{accelerator_cls.__qualname__}` can not run on your system\"\n                \" since the accelerator is not available. The following accelerator(s)\"\n                \" is available and can be passed into `accelerator` argument of\"\n                f\" `Trainer`: {available_accelerator}.\"\n            )\n\n        self._set_devices_flag_if_auto_passed()\n        self._devices_flag = accelerator_cls.parse_devices(self._devices_flag)\n        if not self._parallel_devices:\n            self._parallel_devices = accelerator_cls.get_parallel_devices(self._devices_flag)\n\n    def _set_devices_flag_if_auto_passed(self) -> None:\n        if self._devices_flag != \"auto\":\n            return\n        if (\n            _IS_INTERACTIVE\n            and isinstance(self.accelerator, CUDAAccelerator)\n            and self.accelerator.auto_device_count() > 1","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/trainer/connectors/accelerator_connector.py#L338-L374","documentation":"The requested accelerator class reports is_available() == False on this system. The error lists which accelerators ARE available so you can pick one. Raised during accelerator initialization from the registry.","triggerScenarios":"Trainer(accelerator=MPSAccelerator()) or accelerator='mps' on non-Apple hardware; CUDAAccelerator on a CPU-only box; also custom registered accelerators whose is_available() returns False.","commonSituations":"Sharing configs across heterogeneous machines (mac vs linux vs GPU nodes); deprecated/uninstalled accelerator backends (e.g. HPU/TPU without supporting libraries).","solutions":["Use one of the accelerators listed in the error message","Set accelerator='auto' to let Lightning pick an available one","Fix the environment: install CUDA/ROCm/MPS support so the desired accelerator becomes available"],"exampleFix":"# before\ntrainer = Trainer(accelerator=\"cuda\", devices=1)\n# after\ntrainer = Trainer(accelerator=\"auto\", devices=\"auto\")","handlingStrategy":"fallback","validationCode":"from lightning.pytorch.accelerators import CPUAccelerator\naccelerators = [a for a in (CPUAccelerator,) if a.is_available()]  # extend with CUDA/MPS as needed\naccel_cls = MyAccelerator if MyAccelerator.is_available() else CPUAccelerator\ntrainer = Trainer(accelerator=accel_cls)","typeGuard":"def accelerator_available(accel_cls) -> bool:\n    return bool(accel_cls.is_available())","tryCatchPattern":"from lightning.pytorch.utilities.exceptions import MisconfigurationException\ntry:\n    trainer = Trainer(accelerator=\"cuda\")\nexcept MisconfigurationException as e:\n    if \"is not available\" in str(e):\n        trainer = Trainer(accelerator=\"auto\")\n    else:\n        raise","preventionTips":["Prefer accelerator='auto' for cross-machine configs","Check is_available() on custom accelerator classes before passing them"],"tags":["pytorch-lightning","accelerator","hardware-availability"],"backgroundTag":"hardware-not-available","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}