PaddlePaddle/PaddleOCR · error · ModuleNotFoundError
Please install wandb using `pip install wandb`
Error message
Please install wandb using `pip install wandb`
What it means
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.
Source
Thrown at ppocr/utils/loggers/wandb_logger.py:22
class WandbLogger(BaseLogger):
def __init__(
self,
project=None,
name=None,
id=None,
entity=None,
save_dir=None,
config=None,
**kwargs,
):
try:
import wandb
self.wandb = wandb
except ModuleNotFoundError:
raise ModuleNotFoundError("Please install wandb using `pip install wandb`")
self.project = project
self.name = name
self.id = id
self.save_dir = save_dir
self.config = config
self.kwargs = kwargs
self.entity = entity
self._run = None
self._wandb_init = dict(
project=self.project,
name=self.name,
id=self.id,
entity=self.entity,
dir=self.save_dir,
resume="allow",
)
self._wandb_init.update(**kwargs)View on GitHub (pinned to 2661c7c0ef)
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.
Defensive patterns
Strategy: validation
Validate before calling
def wandb_available() -> bool:
try:
import wandb # noqa: F401
return True
except ModuleNotFoundError:
return False
if cfg['Global'].get('use_wandb', False) and not wandb_available():
raise SystemExit('use_wandb is enabled but wandb is missing: pip install wandb (or set use_wandb: False)') Type guard
def is_wandb_installed() -> bool:
import importlib.util
return importlib.util.find_spec('wandb') is not None Prevention
- 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.
When it happens
Trigger: Setting Global.use_wandb: True (or otherwise instantiating WandbLogger) in an environment where 'import wandb' raises ModuleNotFoundError.
Common situations: 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.
Related errors
- A dependency error occurred during predictor creation. Pleas
- A dependency error occurred during pipeline creation. Please
- Install {module_name} failed, please install manually
- worker mode requires Web Worker support in this environment.
- PaddleOCR.js requires an HTTP(S) origin so model assets can
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/1b1a221d5777ad1a.
Report an issue: GitHub.