Update warning messages

This commit is contained in:
Adriane Boyd 2023-11-05 15:41:03 +01:00
parent e8b715807b
commit ea7a4e0705

View File

@ -84,25 +84,25 @@ def download(
"Download and installation successful", "Download and installation successful",
f"You can now load the package via spacy.load('{model_name}')", f"You can now load the package via spacy.load('{model_name}')",
) )
reload_deps_msg = (
"If you have one or more instances of the Python runtime executing "
"in the background, you'll need to restart them to correctly load "
"the dependencies of the newly downloaded model. "
)
if is_in_jupyter(): if is_in_jupyter():
reload_deps_msg = ( reload_deps_msg = (
f"{reload_deps_msg}This includes the current Jupyter session: " "If you are in a Jupyter or Colab notebook, you may need to "
"You can do this clicking on the 'Restart Kernel' button (or " "restart Python in order to load all the package's dependencies. "
"'Restart Runtime' button in the case of Google Colab)" "You can do this by selecting the 'Restart kernel' or 'Restart "
"runtime' option."
)
msg.warn(
"Restart to reload dependencies",
reload_deps_msg,
) )
elif is_in_interactive(): elif is_in_interactive():
reload_deps_msg = ( reload_deps_msg = (
f"{reload_deps_msg}This includes the current interactive Python session: " "If you are in an interactive Python session, you may need to "
"You can do this by pressing 'Ctrl+D' (or 'Ctrl+Z' and 'Enter' on Windows)." "exit and restart Python to load all the package's dependencies. "
"You can exit with Ctrl-D (or Ctrl-Z and Enter on Windows)."
) )
msg.info( msg.warn(
"Reloading dependencies", "Restart to reload dependencies",
reload_deps_msg, reload_deps_msg,
) )