prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  plotly.express import raises ModuleNotFound in environment without pandas.
  Importing plotly.express when pandas is not available raises `ModuleNotFoundError: No module named 'pandas'`, instead of the intended `ImportError: Plotly express requires pandas to be installed.`
  This happens on `from ._imshow import imshow`.
  Perhaps this import should be moved below the code that will output a more helpful message?
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `packages/python/plotly/plotly/express/__init__.py`
  Content:
  ```
  1 """
  2 `plotly.express` is a terse, consistent, high-level wrapper around `plotly.graph_objects`
  3 for rapid data exploration and figure generation. Learn more at https://plotly.express/
  4 """
  5 from __future__ import absolute_import
  6 from plotly import optional_imports
  7 from ._imshow import imshow
  8 
  9 pd = optional_imports.get_module("pandas")
  10 if pd is None:
  11     raise ImportError(
  12         """\
  13 Plotly express requires pandas to be installed."""
  14     )
  15 
  16 from ._chart_types import (  # noqa: F401
  17     scatter,
  18     scatter_3d,
  19     scatter_polar,
  20     scatter_ternary,
  21     scatter_mapbox,
  22     scatter_geo,
  23     line,
  24     line_3d,
  25     line_polar,
  26     line_ternary,
  27     line_mapbox,
  28     line_geo,
  29     area,
  30     bar,
  31     bar_polar,
  32     violin,
  33     box,
  34     strip,
  35     histogram,
  36     scatter_matrix,
  37     parallel_coordinates,
  38     parallel_categories,
  39     choropleth,
  40     density_contour,
  41     density_heatmap,
  42     pie,
  43     sunburst,
  44     treemap,
  45     funnel,
  46     funnel_area,
  47     choropleth_mapbox,
  48     density_mapbox,
  49 )
  50 
  51 
  52 from ._core import (  # noqa: F401
  53     set_mapbox_access_token,
  54     defaults,
  55     get_trendline_results,
  56 )
  57 
  58 from . import data, colors  # noqa: F401
  59 
  60 __all__ = [
  61     "scatter",
  62     "scatter_3d",
  63     "scatter_polar",
  64     "scatter_ternary",
  65     "scatter_mapbox",
  66     "scatter_geo",
  67     "scatter_matrix",
  68     "density_contour",
  69     "density_heatmap",
  70     "density_mapbox",
  71     "line",
  72     "line_3d",
  73     "line_polar",
  74     "line_ternary",
  75     "line_mapbox",
  76     "line_geo",
  77     "parallel_coordinates",
  78     "parallel_categories",
  79     "area",
  80     "bar",
  81     "bar_polar",
  82     "violin",
  83     "box",
  84     "strip",
  85     "histogram",
  86     "choropleth",
  87     "choropleth_mapbox",
  88     "pie",
  89     "sunburst",
  90     "treemap",
  91     "funnel",
  92     "funnel_area",
  93     "imshow",
  94     "data",
  95     "colors",
  96     "set_mapbox_access_token",
  97     "get_trendline_results",
  98 ]
  99
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/packages/python/plotly/plotly/express/__init__.py b/packages/python/plotly/plotly/express/__init__.py
  --- a/packages/python/plotly/plotly/express/__init__.py
  +++ b/packages/python/plotly/plotly/express/__init__.py
  @@ -4,7 +4,6 @@
   """
   from __future__ import absolute_import
   from plotly import optional_imports
  -from ._imshow import imshow
   
   pd = optional_imports.get_module("pandas")
   if pd is None:
  @@ -13,6 +12,7 @@
   Plotly express requires pandas to be installed."""
       )
   
  +from ._imshow import imshow
   from ._chart_types import (  # noqa: F401
       scatter,
       scatter_3d,
  
verification_info: {"golden_diff": "diff --git a/packages/python/plotly/plotly/express/__init__.py b/packages/python/plotly/plotly/express/__init__.py\n--- a/packages/python/plotly/plotly/express/__init__.py\n+++ b/packages/python/plotly/plotly/express/__init__.py\n@@ -4,7 +4,6 @@\n \"\"\"\n from __future__ import absolute_import\n from plotly import optional_imports\n-from ._imshow import imshow\n \n pd = optional_imports.get_module(\"pandas\")\n if pd is None:\n@@ -13,6 +12,7 @@\n Plotly express requires pandas to be installed.\"\"\"\n     )\n \n+from ._imshow import imshow\n from ._chart_types import (  # noqa: F401\n     scatter,\n     scatter_3d,\n", "issue": "plotly.express import raises ModuleNotFound in environment without pandas.\nImporting plotly.express when pandas is not available raises `ModuleNotFoundError: No module named 'pandas'`, instead of the intended `ImportError: Plotly express requires pandas to be installed.`\r\nThis happens on `from ._imshow import imshow`.\r\nPerhaps this import should be moved below the code that will output a more helpful message?\n", "before_files": [{"content": "\"\"\"\n`plotly.express` is a terse, consistent, high-level wrapper around `plotly.graph_objects`\nfor rapid data exploration and figure generation. Learn more at https://plotly.express/\n\"\"\"\nfrom __future__ import absolute_import\nfrom plotly import optional_imports\nfrom ._imshow import imshow\n\npd = optional_imports.get_module(\"pandas\")\nif pd is None:\n    raise ImportError(\n        \"\"\"\\\nPlotly express requires pandas to be installed.\"\"\"\n    )\n\nfrom ._chart_types import (  # noqa: F401\n    scatter,\n    scatter_3d,\n    scatter_polar,\n    scatter_ternary,\n    scatter_mapbox,\n    scatter_geo,\n    line,\n    line_3d,\n    line_polar,\n    line_ternary,\n    line_mapbox,\n    line_geo,\n    area,\n    bar,\n    bar_polar,\n    violin,\n    box,\n    strip,\n    histogram,\n    scatter_matrix,\n    parallel_coordinates,\n    parallel_categories,\n    choropleth,\n    density_contour,\n    density_heatmap,\n    pie,\n    sunburst,\n    treemap,\n    funnel,\n    funnel_area,\n    choropleth_mapbox,\n    density_mapbox,\n)\n\n\nfrom ._core import (  # noqa: F401\n    set_mapbox_access_token,\n    defaults,\n    get_trendline_results,\n)\n\nfrom . import data, colors  # noqa: F401\n\n__all__ = [\n    \"scatter\",\n    \"scatter_3d\",\n    \"scatter_polar\",\n    \"scatter_ternary\",\n    \"scatter_mapbox\",\n    \"scatter_geo\",\n    \"scatter_matrix\",\n    \"density_contour\",\n    \"density_heatmap\",\n    \"density_mapbox\",\n    \"line\",\n    \"line_3d\",\n    \"line_polar\",\n    \"line_ternary\",\n    \"line_mapbox\",\n    \"line_geo\",\n    \"parallel_coordinates\",\n    \"parallel_categories\",\n    \"area\",\n    \"bar\",\n    \"bar_polar\",\n    \"violin\",\n    \"box\",\n    \"strip\",\n    \"histogram\",\n    \"choropleth\",\n    \"choropleth_mapbox\",\n    \"pie\",\n    \"sunburst\",\n    \"treemap\",\n    \"funnel\",\n    \"funnel_area\",\n    \"imshow\",\n    \"data\",\n    \"colors\",\n    \"set_mapbox_access_token\",\n    \"get_trendline_results\",\n]\n", "path": "packages/python/plotly/plotly/express/__init__.py"}], "after_files": [{"content": "\"\"\"\n`plotly.express` is a terse, consistent, high-level wrapper around `plotly.graph_objects`\nfor rapid data exploration and figure generation. Learn more at https://plotly.express/\n\"\"\"\nfrom __future__ import absolute_import\nfrom plotly import optional_imports\n\npd = optional_imports.get_module(\"pandas\")\nif pd is None:\n    raise ImportError(\n        \"\"\"\\\nPlotly express requires pandas to be installed.\"\"\"\n    )\n\nfrom ._imshow import imshow\nfrom ._chart_types import (  # noqa: F401\n    scatter,\n    scatter_3d,\n    scatter_polar,\n    scatter_ternary,\n    scatter_mapbox,\n    scatter_geo,\n    line,\n    line_3d,\n    line_polar,\n    line_ternary,\n    line_mapbox,\n    line_geo,\n    area,\n    bar,\n    bar_polar,\n    violin,\n    box,\n    strip,\n    histogram,\n    scatter_matrix,\n    parallel_coordinates,\n    parallel_categories,\n    choropleth,\n    density_contour,\n    density_heatmap,\n    pie,\n    sunburst,\n    treemap,\n    funnel,\n    funnel_area,\n    choropleth_mapbox,\n    density_mapbox,\n)\n\n\nfrom ._core import (  # noqa: F401\n    set_mapbox_access_token,\n    defaults,\n    get_trendline_results,\n)\n\nfrom . import data, colors  # noqa: F401\n\n__all__ = [\n    \"scatter\",\n    \"scatter_3d\",\n    \"scatter_polar\",\n    \"scatter_ternary\",\n    \"scatter_mapbox\",\n    \"scatter_geo\",\n    \"scatter_matrix\",\n    \"density_contour\",\n    \"density_heatmap\",\n    \"density_mapbox\",\n    \"line\",\n    \"line_3d\",\n    \"line_polar\",\n    \"line_ternary\",\n    \"line_mapbox\",\n    \"line_geo\",\n    \"parallel_coordinates\",\n    \"parallel_categories\",\n    \"area\",\n    \"bar\",\n    \"bar_polar\",\n    \"violin\",\n    \"box\",\n    \"strip\",\n    \"histogram\",\n    \"choropleth\",\n    \"choropleth_mapbox\",\n    \"pie\",\n    \"sunburst\",\n    \"treemap\",\n    \"funnel\",\n    \"funnel_area\",\n    \"imshow\",\n    \"data\",\n    \"colors\",\n    \"set_mapbox_access_token\",\n    \"get_trendline_results\",\n]\n", "path": "packages/python/plotly/plotly/express/__init__.py"}]}