prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  imageIO warnings due to v2 -> v3 migration
  ## Description
  
  As of imageIO 2.16.0 (Feb22) there are now a v2 and v3 namespaces in addition to the top-level namespace.  As of 2.16.2 (released Apr22) directly using the top-level namespace results in warnings to either explicitly opt-into the v3 API or opt-out and import the v2.  
  
  This in turn causes warnings when using `skimage.io.imread`. 
  
  I suggest that this is a good first issue as there is no API design choices here (at least to start) and only needs the 
  ```python
  try: 
      import newway
  except ImportError: 
      import old way
  ```
  dance.
  
  The warnings look like (lifted from a test suite):
  
  ```
  ____________________________________________________________________________ ReaderSequence.test_slice_of_slice ____________________________________________________________________________
  pims/tests/test_imseq.py:256: in setUp
      self.v = self.klass(self.filename, **self.kwargs)
  pims/image_sequence.py:217: in __init__
      with self.reader_cls(self._filepaths[0], **self.kwargs) as reader:
  pims/image_reader.py:60: in __init__
      self._data = Frame(imread(filename, **kwargs), frame_no=0)
  ../../../../.pybuild/bleeding/lib/python3.11/contextlib.py:155: in __exit__
      self.gen.throw(typ, value, traceback)
  ../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/util.py:43: in file_or_url_context
      yield resource_name
  ../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/_io.py:53: in imread
      img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
  ../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/manage_plugins.py:207: in call_plugin
      return func(*args, **kwargs)
  ../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/_plugins/imageio_plugin.py:10: in imread
      return np.asarray(imageio_imread(*args, **kwargs))
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
  uri = '/home/tcaswell/source/bnl/soft-matter/pims/pims/tests/data/image_sequence3d/file001.png', format = None, kwargs = {}
  
      def imread(uri, format=None, **kwargs):
          """imread(uri, format=None, **kwargs)
      
          Reads an image from the specified file. Returns a numpy array, which
          comes with a dict of meta data at its 'meta' attribute.
      
          Note that the image data is returned as-is, and may not always have
          a dtype of uint8 (and thus may differ from what e.g. PIL returns).
      
          Parameters
          ----------
          uri : {str, pathlib.Path, bytes, file}
              The resource to load the image from, e.g. a filename, pathlib.Path,
              http address or file object, see the docs for more info.
          format : str
              The format to use to read the file. By default imageio selects
              the appropriate for you based on the filename and its contents.
          kwargs : ...
              Further keyword arguments are passed to the reader. See :func:`.help`
              to see what arguments are available for a particular format.
          """
      
  >       warnings.warn(
              "Starting with ImageIO v3 the behavior of this function will switch to that of"
              " iio.v3.imread. To keep the current behavior (and make this warning dissapear)"
              " use `import imageio.v2 as imageio` or call `imageio.v2.imread` directly.",
              DeprecationWarning,
          )
  E       DeprecationWarning: Starting with ImageIO v3 the behavior of this function will switch to that of iio.v3.imread. To keep the current behavior (and make this warning dissapear) use `import imageio.v2 as imageio` or call `imageio.v2.imread` directly.
  
  ../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/imageio/__init__.py:89: DeprecationWarning
  
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `skimage/io/_plugins/imageio_plugin.py`
  Content:
  ```
  1 __all__ = ['imread', 'imsave']
  2 
  3 from functools import wraps
  4 import numpy as np
  5 from imageio import imread as imageio_imread, imsave
  6 
  7 
  8 @wraps(imageio_imread)
  9 def imread(*args, **kwargs):
  10     return np.asarray(imageio_imread(*args, **kwargs))
  11
  ```
  --- 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/skimage/io/_plugins/imageio_plugin.py b/skimage/io/_plugins/imageio_plugin.py
  --- a/skimage/io/_plugins/imageio_plugin.py
  +++ b/skimage/io/_plugins/imageio_plugin.py
  @@ -2,7 +2,12 @@
   
   from functools import wraps
   import numpy as np
  -from imageio import imread as imageio_imread, imsave
  +
  +try:
  +    # Try using the v2 API directly to avoid a warning from imageio >= 2.16.2
  +    from imageio.v2 import imread as imageio_imread, imsave
  +except ImportError:
  +    from imageio import imread as imageio_imread, imsave
   
   
   @wraps(imageio_imread)
  
verification_info: {"golden_diff": "diff --git a/skimage/io/_plugins/imageio_plugin.py b/skimage/io/_plugins/imageio_plugin.py\n--- a/skimage/io/_plugins/imageio_plugin.py\n+++ b/skimage/io/_plugins/imageio_plugin.py\n@@ -2,7 +2,12 @@\n \n from functools import wraps\n import numpy as np\n-from imageio import imread as imageio_imread, imsave\n+\n+try:\n+    # Try using the v2 API directly to avoid a warning from imageio >= 2.16.2\n+    from imageio.v2 import imread as imageio_imread, imsave\n+except ImportError:\n+    from imageio import imread as imageio_imread, imsave\n \n \n @wraps(imageio_imread)\n", "issue": "imageIO warnings due to v2 -> v3 migration\n## Description\r\n\r\nAs of imageIO 2.16.0 (Feb22) there are now a v2 and v3 namespaces in addition to the top-level namespace.  As of 2.16.2 (released Apr22) directly using the top-level namespace results in warnings to either explicitly opt-into the v3 API or opt-out and import the v2.  \r\n\r\nThis in turn causes warnings when using `skimage.io.imread`. \r\n\r\nI suggest that this is a good first issue as there is no API design choices here (at least to start) and only needs the \r\n```python\r\ntry: \r\n    import newway\r\nexcept ImportError: \r\n    import old way\r\n```\r\ndance.\r\n\r\nThe warnings look like (lifted from a test suite):\r\n\r\n```\r\n____________________________________________________________________________ ReaderSequence.test_slice_of_slice ____________________________________________________________________________\r\npims/tests/test_imseq.py:256: in setUp\r\n    self.v = self.klass(self.filename, **self.kwargs)\r\npims/image_sequence.py:217: in __init__\r\n    with self.reader_cls(self._filepaths[0], **self.kwargs) as reader:\r\npims/image_reader.py:60: in __init__\r\n    self._data = Frame(imread(filename, **kwargs), frame_no=0)\r\n../../../../.pybuild/bleeding/lib/python3.11/contextlib.py:155: in __exit__\r\n    self.gen.throw(typ, value, traceback)\r\n../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/util.py:43: in file_or_url_context\r\n    yield resource_name\r\n../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/_io.py:53: in imread\r\n    img = call_plugin('imread', fname, plugin=plugin, **plugin_args)\r\n../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/manage_plugins.py:207: in call_plugin\r\n    return func(*args, **kwargs)\r\n../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/skimage/io/_plugins/imageio_plugin.py:10: in imread\r\n    return np.asarray(imageio_imread(*args, **kwargs))\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\nuri = '/home/tcaswell/source/bnl/soft-matter/pims/pims/tests/data/image_sequence3d/file001.png', format = None, kwargs = {}\r\n\r\n    def imread(uri, format=None, **kwargs):\r\n        \"\"\"imread(uri, format=None, **kwargs)\r\n    \r\n        Reads an image from the specified file. Returns a numpy array, which\r\n        comes with a dict of meta data at its 'meta' attribute.\r\n    \r\n        Note that the image data is returned as-is, and may not always have\r\n        a dtype of uint8 (and thus may differ from what e.g. PIL returns).\r\n    \r\n        Parameters\r\n        ----------\r\n        uri : {str, pathlib.Path, bytes, file}\r\n            The resource to load the image from, e.g. a filename, pathlib.Path,\r\n            http address or file object, see the docs for more info.\r\n        format : str\r\n            The format to use to read the file. By default imageio selects\r\n            the appropriate for you based on the filename and its contents.\r\n        kwargs : ...\r\n            Further keyword arguments are passed to the reader. See :func:`.help`\r\n            to see what arguments are available for a particular format.\r\n        \"\"\"\r\n    \r\n>       warnings.warn(\r\n            \"Starting with ImageIO v3 the behavior of this function will switch to that of\"\r\n            \" iio.v3.imread. To keep the current behavior (and make this warning dissapear)\"\r\n            \" use `import imageio.v2 as imageio` or call `imageio.v2.imread` directly.\",\r\n            DeprecationWarning,\r\n        )\r\nE       DeprecationWarning: Starting with ImageIO v3 the behavior of this function will switch to that of iio.v3.imread. To keep the current behavior (and make this warning dissapear) use `import imageio.v2 as imageio` or call `imageio.v2.imread` directly.\r\n\r\n../../../../.virtualenvs/bleeding/lib/python3.11/site-packages/imageio/__init__.py:89: DeprecationWarning\r\n\r\n```\n", "before_files": [{"content": "__all__ = ['imread', 'imsave']\n\nfrom functools import wraps\nimport numpy as np\nfrom imageio import imread as imageio_imread, imsave\n\n\n@wraps(imageio_imread)\ndef imread(*args, **kwargs):\n    return np.asarray(imageio_imread(*args, **kwargs))\n", "path": "skimage/io/_plugins/imageio_plugin.py"}], "after_files": [{"content": "__all__ = ['imread', 'imsave']\n\nfrom functools import wraps\nimport numpy as np\n\ntry:\n    # Try using the v2 API directly to avoid a warning from imageio >= 2.16.2\n    from imageio.v2 import imread as imageio_imread, imsave\nexcept ImportError:\n    from imageio import imread as imageio_imread, imsave\n\n\n@wraps(imageio_imread)\ndef imread(*args, **kwargs):\n    return np.asarray(imageio_imread(*args, **kwargs))\n", "path": "skimage/io/_plugins/imageio_plugin.py"}]}