We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error Importing Pandera with Polars extra
**Describe the bug**
I get an error when importing pandera after installing the latest 0.19.0b2 version with the polars extra in a clean environment. I can import it successfully if I install without the polars extra.

- [x] I have checked that this issue has not already been reported.
- [x] I have confirmed this bug exists on the latest version of pandera.
- [ ] (optional) I have confirmed this bug exists on the main branch of pandera.

#### Code Sample, a copy-pastable example

I installed pandera 0.19.0b2 in a clean virtual environment using `pip install pandera[polars]==0.19.0b2` and attempted to import pandera:

```python
import pandera as pa
```

I got the following error message:
```
>>> import pandera as pa
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".venv/lib/python3.11/site-packages/pandera/__init__.py", line 6, in <module>
    from pandera import errors, external_config, typing
  File ".venv/lib/python3.11/site-packages/pandera/external_config.py", line 23, in <module>
    import pyspark.pandas
ModuleNotFoundError: No module named 'pyspark'
```

#### Versions:

 - Pandera: 0.19.0b2
 - Python: 3.11.7
 - Ubuntu: 22.04


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pandera/external_config.py`
Content:
```
1 """Configuration for external packages."""
2 
3 import os
4 
5 is_spark_local_ip_dirty = False
6 is_pyarrow_ignore_timezone_dirty = False
7 
8 try:
9     # try importing pyspark to see if it exists. This is important because the
10     # pandera.typing module defines a Series type that inherits from
11     # pandas.Series, and pyspark v1+ injects a __getitem__ method to pandas
12     # Series and DataFrames to support type hinting:
13     # https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/typehints.html#type-hinting-with-names
14     # pylint: disable=unused-import
15     if os.getenv("SPARK_LOCAL_IP") is None:
16         is_spark_local_ip_dirty = True
17         os.environ["SPARK_LOCAL_IP"] = "127.0.0.1"
18     if os.getenv("PYARROW_IGNORE_TIMEZONE") is None:
19         is_pyarrow_ignore_timezone_dirty = True
20         # This can be overriden by the user
21         os.environ["PYARROW_IGNORE_TIMEZONE"] = "1"
22 
23     import pyspark.pandas
24 finally:
25     if is_spark_local_ip_dirty:
26         os.environ.pop("SPARK_LOCAL_IP")
27     if is_pyarrow_ignore_timezone_dirty:
28         os.environ.pop("PYARROW_IGNORE_TIMEZONE")
29
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pandera/external_config.py b/pandera/external_config.py
--- a/pandera/external_config.py
+++ b/pandera/external_config.py
@@ -21,6 +21,8 @@
         os.environ["PYARROW_IGNORE_TIMEZONE"] = "1"
 
     import pyspark.pandas
+except (ImportError, ModuleNotFoundError):
+    pass
 finally:
     if is_spark_local_ip_dirty:
         os.environ.pop("SPARK_LOCAL_IP")

{"golden_diff": "diff --git a/pandera/external_config.py b/pandera/external_config.py\n--- a/pandera/external_config.py\n+++ b/pandera/external_config.py\n@@ -21,6 +21,8 @@\n         os.environ[\"PYARROW_IGNORE_TIMEZONE\"] = \"1\"\n \n     import pyspark.pandas\n+except (ImportError, ModuleNotFoundError):\n+    pass\n finally:\n     if is_spark_local_ip_dirty:\n         os.environ.pop(\"SPARK_LOCAL_IP\")\n", "issue": "Error Importing Pandera with Polars extra\n**Describe the bug**\r\nI get an error when importing pandera after installing the latest 0.19.0b2 version with the polars extra in a clean environment. I can import it successfully if I install without the polars extra.\r\n\r\n- [x] I have checked that this issue has not already been reported.\r\n- [x] I have confirmed this bug exists on the latest version of pandera.\r\n- [ ] (optional) I have confirmed this bug exists on the main branch of pandera.\r\n\r\n#### Code Sample, a copy-pastable example\r\n\r\nI installed pandera 0.19.0b2 in a clean virtual environment using `pip install pandera[polars]==0.19.0b2` and attempted to import pandera:\r\n\r\n```python\r\nimport pandera as pa\r\n```\r\n\r\nI got the following error message:\r\n```\r\n>>> import pandera as pa\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \".venv/lib/python3.11/site-packages/pandera/__init__.py\", line 6, in <module>\r\n    from pandera import errors, external_config, typing\r\n  File \".venv/lib/python3.11/site-packages/pandera/external_config.py\", line 23, in <module>\r\n    import pyspark.pandas\r\nModuleNotFoundError: No module named 'pyspark'\r\n```\r\n\r\n#### Versions:\r\n\r\n - Pandera: 0.19.0b2\r\n - Python: 3.11.7\r\n - Ubuntu: 22.04\r\n\n", "before_files": [{"content": "\"\"\"Configuration for external packages.\"\"\"\n\nimport os\n\nis_spark_local_ip_dirty = False\nis_pyarrow_ignore_timezone_dirty = False\n\ntry:\n    # try importing pyspark to see if it exists. This is important because the\n    # pandera.typing module defines a Series type that inherits from\n    # pandas.Series, and pyspark v1+ injects a __getitem__ method to pandas\n    # Series and DataFrames to support type hinting:\n    # https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/typehints.html#type-hinting-with-names\n    # pylint: disable=unused-import\n    if os.getenv(\"SPARK_LOCAL_IP\") is None:\n        is_spark_local_ip_dirty = True\n        os.environ[\"SPARK_LOCAL_IP\"] = \"127.0.0.1\"\n    if os.getenv(\"PYARROW_IGNORE_TIMEZONE\") is None:\n        is_pyarrow_ignore_timezone_dirty = True\n        # This can be overriden by the user\n        os.environ[\"PYARROW_IGNORE_TIMEZONE\"] = \"1\"\n\n    import pyspark.pandas\nfinally:\n    if is_spark_local_ip_dirty:\n        os.environ.pop(\"SPARK_LOCAL_IP\")\n    if is_pyarrow_ignore_timezone_dirty:\n        os.environ.pop(\"PYARROW_IGNORE_TIMEZONE\")\n", "path": "pandera/external_config.py"}], "after_files": [{"content": "\"\"\"Configuration for external packages.\"\"\"\n\nimport os\n\nis_spark_local_ip_dirty = False\nis_pyarrow_ignore_timezone_dirty = False\n\ntry:\n    # try importing pyspark to see if it exists. This is important because the\n    # pandera.typing module defines a Series type that inherits from\n    # pandas.Series, and pyspark v1+ injects a __getitem__ method to pandas\n    # Series and DataFrames to support type hinting:\n    # https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/typehints.html#type-hinting-with-names\n    # pylint: disable=unused-import\n    if os.getenv(\"SPARK_LOCAL_IP\") is None:\n        is_spark_local_ip_dirty = True\n        os.environ[\"SPARK_LOCAL_IP\"] = \"127.0.0.1\"\n    if os.getenv(\"PYARROW_IGNORE_TIMEZONE\") is None:\n        is_pyarrow_ignore_timezone_dirty = True\n        # This can be overriden by the user\n        os.environ[\"PYARROW_IGNORE_TIMEZONE\"] = \"1\"\n\n    import pyspark.pandas\nexcept (ImportError, ModuleNotFoundError):\n    pass\nfinally:\n    if is_spark_local_ip_dirty:\n        os.environ.pop(\"SPARK_LOCAL_IP\")\n    if is_pyarrow_ignore_timezone_dirty:\n        os.environ.pop(\"PYARROW_IGNORE_TIMEZONE\")\n", "path": "pandera/external_config.py"}]}