prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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
  
  
  </issue>
  <code>
  [start of pandera/external_config.py]
  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 of pandera/external_config.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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")
  
verification_info: {"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"}]}