Repository: modin-project/modin

Issue:
BUG: NoneType has no attribute read_parquet
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
../.local/lib/python3.9/site-packages/modin/logging/logger_decorator.py:128: in run_and_log
    return obj(*args, **kwargs)
../.local/lib/python3.9/site-packages/modin/pandas/io.py:309: in read_parquet
    query_compiler=FactoryDispatcher.read_parquet(
../.local/lib/python3.9/site-packages/modin/core/execution/dispatching/factories/dispatcher.py:183: in read_parquet
    return cls.get_factory()._read_parquet(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'modin.core.execution.dispatching.factories.factories.ExperimentalHdkOnNativeFactory'>
kwargs = {'columns': None, 'engine': 'pyarrow', 'path': 's3://coiled-runtime-ci/ookla-open-data/type=fixed/**.parquet', 'storage_options': None, ...}

    @classmethod
    @doc(
        _doc_io_method_template,
        source="a Parquet file",
        params=_doc_io_method_kwargs_params,
        method="read_parquet",
    )
    def _read_parquet(cls, **kwargs):
>       return cls.io_cls.read_parquet(**kwargs)
E       AttributeError: 'NoneType' object has no attribute 'read_parquet'

../.local/lib/python3.9/site-packages/modin/core/execution/dispatching/factories/factories.py:213: AttributeError
```


### Issue Description

Trying to read a parquet file using the HDK backend. 

### Expected Behavior

 NA

### Error Logs

<details>

```python-traceback

Replace this line with the error backtrace (if applicable).

```

</details>


### Installed Versions

<details>

Replace this line with the output of pd.show_versions()

</details>



Discussion:
@jbrockmendel I can't reproduce the problem. Could you provide self-contained example?
The problem is reproduced if one run the tests with the environment variables set for hdk, but without the hdk in the environment.

Resolving patch:
diff --git a/modin/core/execution/dispatching/factories/dispatcher.py b/modin/core/execution/dispatching/factories/dispatcher.py
--- a/modin/core/execution/dispatching/factories/dispatcher.py
+++ b/modin/core/execution/dispatching/factories/dispatcher.py
@@ -155,7 +155,16 @@ def _update_factory(cls, _):
                 raise FactoryNotFoundError(msg.format(factory_name))
             cls.__factory = StubFactory.set_failing_name(factory_name)
         else:
-            cls.__factory.prepare()
+            try:
+                cls.__factory.prepare()
+            except ModuleNotFoundError as err:
+                # incorrectly initialized, should be reset to None again
+                # so that an unobvious error does not appear in the following code:
+                # "AttributeError: 'NoneType' object has no attribute 'from_non_pandas'"
+                cls.__factory = None
+                raise ModuleNotFoundError(
+                    f"Make sure all required packages are installed: {str(err)}"
+                ) from err
 
     @classmethod
     @_inherit_docstrings(factories.BaseFactory._from_pandas)


Test patch: