diff --git a/CHANGELOG.md b/CHANGELOG.md index eb64bc22cb..3a05145404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.8.2-dev3 +## 0.8.2-dev4 ### Enhancements @@ -18,6 +18,7 @@ * Adds `.txt`, `.text`, and `.tab` to list of extensions to check if file has a `text/plain` MIME type. * Enables filters to be passed to `partition_doc` so it doesn't error with LibreOffice7. +* Removed old error message that's superseded by `requires_dependencies`. ## 0.8.1 diff --git a/unstructured/__version__.py b/unstructured/__version__.py index a7051e5005..1866fb8806 100644 --- a/unstructured/__version__.py +++ b/unstructured/__version__.py @@ -1 +1 @@ -__version__ = "0.8.2-dev3" # pragma: no cover +__version__ = "0.8.2-dev4" # pragma: no cover diff --git a/unstructured/partition/pdf.py b/unstructured/partition/pdf.py index e87db9ab84..703d829e9a 100644 --- a/unstructured/partition/pdf.py +++ b/unstructured/partition/pdf.py @@ -189,25 +189,10 @@ def _partition_pdf_or_image_local( **kwargs, ) -> List[Element]: """Partition using package installed locally.""" - try: - from unstructured_inference.inference.layout import ( - process_data_with_model, - process_file_with_model, - ) - except ModuleNotFoundError as e: - raise Exception( - "unstructured_inference module not found... try running pip install " - "unstructured[local-inference] if you installed the unstructured library as a package. " - "If you cloned the unstructured repository, try running make install-local-inference " - "from the root directory of the repository.", - ) from e - except ImportError as e: - raise Exception( - "There was a problem importing unstructured_inference module - it may not be installed " - "correctly... try running pip install unstructured[local-inference] if you installed " - "the unstructured library as a package. If you cloned the unstructured repository, try " - "running make install-local-inference from the root directory of the repository.", - ) from e + from unstructured_inference.inference.layout import ( + process_data_with_model, + process_file_with_model, + ) model_name = model_name if model_name else os.environ.get("UNSTRUCTURED_HI_RES_MODEL_NAME") if file is None: diff --git a/unstructured/utils.py b/unstructured/utils.py index d5a8de4346..5a10af77ce 100644 --- a/unstructured/utils.py +++ b/unstructured/utils.py @@ -50,8 +50,10 @@ def wrapper(*args, **kwargs): def dependency_exists(dependency): try: importlib.import_module(dependency) - except ImportError: - return False + except ImportError as e: + # Check to make sure this isn't some unrelated import error. + if dependency in repr(e): + return False return True