From f238251496a6ec5168c014879a4d21c178fb91c6 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:55:05 -0700 Subject: [PATCH] fix: lazy check for stubs via path when install local wheels (#3180) --- src/bentoml/_internal/bento/build_dev_bentoml_whl.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/bentoml/_internal/bento/build_dev_bentoml_whl.py b/src/bentoml/_internal/bento/build_dev_bentoml_whl.py index f833690bf80..0658362b58b 100644 --- a/src/bentoml/_internal/bento/build_dev_bentoml_whl.py +++ b/src/bentoml/_internal/bento/build_dev_bentoml_whl.py @@ -43,11 +43,7 @@ def build_bentoml_editable_wheel(target_path: str) -> None: raise BentoMLException("Could not find bentoml module location.") bentoml_path = Path(module_location) - try: - from importlib import import_module - - _ = import_module("bentoml.grpc.v1alpha1.service_pb2") - except ModuleNotFoundError: + if not Path(module_location, "grpc", "v1alpha1", "service_pb2.py").exists(): raise ModuleNotFoundError( f"Generated stubs are not found. Make sure to run '{bentoml_path.as_posix()}/scripts/generate_grpc_stubs.sh' beforehand to generate gRPC stubs." ) from None