Skip to content

Commit

Permalink
Add a one-time warning message about uninstalled packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
mzweilin committed May 10, 2024
1 parent 5d58f07 commit 6c6331e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mart/utils/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@

from importlib.util import find_spec

from .pylogger import get_pylogger

logger = get_pylogger(__name__)


def has(module_name):
return find_spec(module_name) is not None
module = find_spec(module_name)
if module is None:
logger.warn(f"{module_name} is not installed, so some features in MART are unavailable.")
return False
else:
return True


_HAS_FIFTYONE = has("fiftyone")
Expand Down

0 comments on commit 6c6331e

Please sign in to comment.