Skip to content

Commit

Permalink
Add import error messages for integrations now that auto install has …
Browse files Browse the repository at this point in the history
…been removed (#1030)

(cherry picked from commit 4e03e41)
  • Loading branch information
markurtz authored and rahul-tuli committed May 18, 2023
1 parent 3d129fc commit 4fcd756
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/deepsparse/image_classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@
from deepsparse.analytics import deepsparse_analytics as _analytics


_analytics.send_event("python__image_classification__init")
try:
import torchvision as _torchvision

import cv2 as _cv2
except ImportError:
raise ImportError(
"Please install deepsparse[image_classification] to use this pathway"
)


from .constants import *
from .pipelines import *
from .schemas import *


_analytics.send_event("python__image_classification__init")
7 changes: 7 additions & 0 deletions src/deepsparse/open_pif_paf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
# flake8: noqa
from deepsparse.analytics import deepsparse_analytics as _analytics


try:
import cv2 as _cv2
import openpifpaf as _openpifpaf
except ImportError:
raise ImportError("Please install deepsparse[openpifpaf] to use this pathway")

from .utils import *


Expand Down
8 changes: 8 additions & 0 deletions src/deepsparse/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@

from deepsparse.analytics import deepsparse_analytics as _analytics


try:
import uvicorn as _uvicorn
from fastapi import FastAPI as _FastAPI
from starlette.responses import RedirectResponse as _RedirectResponse
except ImportError:
raise ImportError("Please install deepsparse[server] to use this pathway")

from .cli import main


Expand Down
8 changes: 8 additions & 0 deletions src/deepsparse/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
_analytics.send_event("python__transformers__init")


try:
import transformers as _transformers

import datasets as _datasets
except ImportError:
raise ImportError("Please install deepsparse[transformers] to use this pathway")


_LOGGER = _logging.getLogger(__name__)


Expand Down
8 changes: 8 additions & 0 deletions src/deepsparse/yolo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

from deepsparse.analytics import deepsparse_analytics as _analytics


try:
import torchvision as _torchvision

import cv2 as _cv2
except ImportError:
raise ImportError("Please install deepsparse[yolo] to use this pathway")

from .annotate import *
from .pipelines import *
from .schemas import *
Expand Down
7 changes: 7 additions & 0 deletions src/deepsparse/yolov8/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

from deepsparse.analytics import deepsparse_analytics as _analytics


try:
import ultralytics as _ultralytics
except ImportError:
raise ImportError("Please install deepsparse[yolov8] to use this pathway")


from .annotate import *
from .pipelines import *
from .schemas import *
Expand Down

0 comments on commit 4fcd756

Please sign in to comment.