Skip to content

Commit

Permalink
feat: improved error messages when missing backend dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Jul 26, 2023
1 parent 6e634b8 commit 2fe851b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ibis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ def __getattr__(name: str) -> BaseBackend:
import ibis

(entry_point,) = entry_points
module = entry_point.load()
try:
module = entry_point.load()
except ImportError as exc:
raise ImportError(
f"Failed to import the {name} backend due to missing dependencies.\n\n"
f"You can pip or conda install the {name} backend as follows:\n\n"
f' python -m pip install -U "ibis-framework[{name}]" # pip install\n'
f" conda install -c conda-forge ibis-{name} # or conda install"
) from exc
backend = module.Backend()
# The first time a backend is loaded, we register its options, and we set
# it as an attribute of `ibis`, so `__getattr__` is not called again for it
Expand Down

0 comments on commit 2fe851b

Please sign in to comment.