From 2010219a7ff2d6e02f76e407fe6ec6dd5c94927f Mon Sep 17 00:00:00 2001 From: svlandeg Date: Fri, 26 Feb 2021 18:00:39 +0100 Subject: [PATCH] import wandb failure - UX --- spacy/errors.py | 3 +++ spacy/training/loggers.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spacy/errors.py b/spacy/errors.py index f8a461dbd..fc98fdaa6 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -487,6 +487,9 @@ class Errors: # New errors added in v3.x + E880 = ("The 'wandb' library could not be found - did you install it? " + "Alternatively, specify the 'ConsoleLogger' in the 'training.logger' " + "config section, instead of the 'WandbLogger'.") E885 = ("entity_linker.set_kb received an invalid 'kb_loader' argument: expected " "a callable function, but got: {arg_type}") E886 = ("Can't replace {name} -> {tok2vec} listeners: path '{path}' not " diff --git a/spacy/training/loggers.py b/spacy/training/loggers.py index 79459a89b..8acf2783c 100644 --- a/spacy/training/loggers.py +++ b/spacy/training/loggers.py @@ -103,7 +103,11 @@ def console_logger(progress_bar: bool = False): @registry.loggers("spacy.WandbLogger.v1") def wandb_logger(project_name: str, remove_config_values: List[str] = []): - import wandb + try: + import wandb + from wandb import init, log, join # test that these are available + except ImportError: + raise ImportError(Errors.E880) console = console_logger(progress_bar=False)