diff --git a/python/dask_cudf/dask_cudf/expr/__init__.py b/python/dask_cudf/dask_cudf/expr/__init__.py index c36dd0abcb9..826f514a674 100644 --- a/python/dask_cudf/dask_cudf/expr/__init__.py +++ b/python/dask_cudf/dask_cudf/expr/__init__.py @@ -7,12 +7,12 @@ QUERY_PLANNING_ON = config.get("dataframe.query-planning", None) is not False # Register custom expressions and collections -try: - import dask_cudf.expr._collection - import dask_cudf.expr._expr +if QUERY_PLANNING_ON: + try: + import dask_cudf.expr._collection + import dask_cudf.expr._expr -except ImportError as err: - if QUERY_PLANNING_ON: + except ImportError as err: # Dask *should* raise an error before this. # However, we can still raise here to be certain. raise RuntimeError(