{"record":{"id":"1b1a221d5777ad1a","repo":"PaddlePaddle/PaddleOCR","slug":"please-install-wandb-using-pip-install-wandb","errorCode":null,"errorMessage":"Please install wandb using `pip install wandb`","messagePattern":"Please install wandb using `pip install wandb`","errorType":"exception","errorClass":"ModuleNotFoundError","httpStatus":null,"severity":"error","filePath":"ppocr/utils/loggers/wandb_logger.py","lineNumber":22,"sourceCode":"\n\nclass WandbLogger(BaseLogger):\n    def __init__(\n        self,\n        project=None,\n        name=None,\n        id=None,\n        entity=None,\n        save_dir=None,\n        config=None,\n        **kwargs,\n    ):\n        try:\n            import wandb\n\n            self.wandb = wandb\n        except ModuleNotFoundError:\n            raise ModuleNotFoundError(\"Please install wandb using `pip install wandb`\")\n\n        self.project = project\n        self.name = name\n        self.id = id\n        self.save_dir = save_dir\n        self.config = config\n        self.kwargs = kwargs\n        self.entity = entity\n        self._run = None\n        self._wandb_init = dict(\n            project=self.project,\n            name=self.name,\n            id=self.id,\n            entity=self.entity,\n            dir=self.save_dir,\n            resume=\"allow\",\n        )\n        self._wandb_init.update(**kwargs)","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/ppocr/utils/loggers/wandb_logger.py#L4-L40","documentation":"ModuleNotFoundError raised by WandbLogger.__init__ when the wandb package is not installed in the current environment. PaddleOCR only imports wandb lazily inside the logger, so the failure appears at training startup exactly when the config selects the wandb logger.","triggerScenarios":"Setting Global.use_wandb: True (or otherwise instantiating WandbLogger) in an environment where 'import wandb' raises ModuleNotFoundError.","commonSituations":"Following a training config from a tutorial that enables wandb logging; CI/docker images built from requirements.txt that omit the optional wandb dependency; switching conda/venv environments.","solutions":["pip install wandb in the active environment.","Or disable wandb in the config (use_wandb: False / remove the wandb logger entry) if experiment tracking is not needed.","For offline machines, pip install wandb on a connected host matching the same Python version and copy the wheel."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def wandb_available() -> bool:\n    try:\n        import wandb  # noqa: F401\n        return True\n    except ModuleNotFoundError:\n        return False\n\nif cfg['Global'].get('use_wandb', False) and not wandb_available():\n    raise SystemExit('use_wandb is enabled but wandb is missing: pip install wandb (or set use_wandb: False)')","typeGuard":"def is_wandb_installed() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('wandb') is not None","tryCatchPattern":null,"preventionTips":["Declare optional extras in your environment setup (pip install paddleocr[wandb]-style pinning of wandb) when configs enable wandb.","Gate wandb logging behind an availability check so training can proceed without it."],"tags":["logging","dependency","training","environment"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}