prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  tifffile: try to use the one in the user's install first
  Should we try importing tifffile before using the one we versionned it?
  
  --- 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/tifffile_plugin.py`
  Content:
  ```
  1 from ...external.tifffile import TiffFile, imsave, parse_kwargs
  2 
  3 
  4 def imread(fname, dtype=None, **kwargs):
  5     """Load a tiff image from file.
  6 
  7     Parameters
  8     ----------
  9     fname : str or file
  10        File name or file-like-object.
  11     dtype : numpy dtype object or string specifier
  12        Specifies data type of array elements (Not currently used).
  13     kwargs : keyword pairs, optional
  14         Additional keyword arguments to pass through (see ``tifffile``'s
  15         ``imread`` function).
  16 
  17     Notes
  18     -----
  19     Provided by Christophe Golhke's tifffile.py [1]_, and supports many
  20     advanced image types including multi-page and floating point.
  21 
  22     References
  23     ----------
  24     .. [1] http://www.lfd.uci.edu/~gohlke/code/tifffile.py
  25 
  26     """
  27 
  28     if 'img_num' in kwargs:
  29         kwargs['key'] = kwargs.pop('img_num')
  30 
  31     # parse_kwargs will extract keyword arguments intended for the TiffFile 
  32     # class and remove them from the kwargs dictionary in-place
  33     tiff_keys = ['multifile', 'multifile_close', 'pages', 'fastij', 'is_ome']
  34     kwargs_tiff = parse_kwargs(kwargs, *tiff_keys)
  35 
  36     # read and return tiff as numpy array
  37     with TiffFile(fname, **kwargs_tiff) as tif:
  38         return tif.asarray(**kwargs)
  39
  ```
  --- 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/tifffile_plugin.py b/skimage/io/_plugins/tifffile_plugin.py
  --- a/skimage/io/_plugins/tifffile_plugin.py
  +++ b/skimage/io/_plugins/tifffile_plugin.py
  @@ -1,4 +1,7 @@
  -from ...external.tifffile import TiffFile, imsave, parse_kwargs
  +try:
  +    from tifffile import TiffFile, imsave, parse_kwargs
  +except ImportError:
  +    from ...external.tifffile import TiffFile, imsave, parse_kwargs
   
   
   def imread(fname, dtype=None, **kwargs):
  
verification_info: {"golden_diff": "diff --git a/skimage/io/_plugins/tifffile_plugin.py b/skimage/io/_plugins/tifffile_plugin.py\n--- a/skimage/io/_plugins/tifffile_plugin.py\n+++ b/skimage/io/_plugins/tifffile_plugin.py\n@@ -1,4 +1,7 @@\n-from ...external.tifffile import TiffFile, imsave, parse_kwargs\n+try:\n+    from tifffile import TiffFile, imsave, parse_kwargs\n+except ImportError:\n+    from ...external.tifffile import TiffFile, imsave, parse_kwargs\n \n \n def imread(fname, dtype=None, **kwargs):\n", "issue": "tifffile: try to use the one in the user's install first\nShould we try importing tifffile before using the one we versionned it?\n", "before_files": [{"content": "from ...external.tifffile import TiffFile, imsave, parse_kwargs\n\n\ndef imread(fname, dtype=None, **kwargs):\n    \"\"\"Load a tiff image from file.\n\n    Parameters\n    ----------\n    fname : str or file\n       File name or file-like-object.\n    dtype : numpy dtype object or string specifier\n       Specifies data type of array elements (Not currently used).\n    kwargs : keyword pairs, optional\n        Additional keyword arguments to pass through (see ``tifffile``'s\n        ``imread`` function).\n\n    Notes\n    -----\n    Provided by Christophe Golhke's tifffile.py [1]_, and supports many\n    advanced image types including multi-page and floating point.\n\n    References\n    ----------\n    .. [1] http://www.lfd.uci.edu/~gohlke/code/tifffile.py\n\n    \"\"\"\n\n    if 'img_num' in kwargs:\n        kwargs['key'] = kwargs.pop('img_num')\n\n    # parse_kwargs will extract keyword arguments intended for the TiffFile \n    # class and remove them from the kwargs dictionary in-place\n    tiff_keys = ['multifile', 'multifile_close', 'pages', 'fastij', 'is_ome']\n    kwargs_tiff = parse_kwargs(kwargs, *tiff_keys)\n\n    # read and return tiff as numpy array\n    with TiffFile(fname, **kwargs_tiff) as tif:\n        return tif.asarray(**kwargs)\n", "path": "skimage/io/_plugins/tifffile_plugin.py"}], "after_files": [{"content": "try:\n    from tifffile import TiffFile, imsave, parse_kwargs\nexcept ImportError:\n    from ...external.tifffile import TiffFile, imsave, parse_kwargs\n\n\ndef imread(fname, dtype=None, **kwargs):\n    \"\"\"Load a tiff image from file.\n\n    Parameters\n    ----------\n    fname : str or file\n       File name or file-like-object.\n    dtype : numpy dtype object or string specifier\n       Specifies data type of array elements (Not currently used).\n    kwargs : keyword pairs, optional\n        Additional keyword arguments to pass through (see ``tifffile``'s\n        ``imread`` function).\n\n    Notes\n    -----\n    Provided by Christophe Golhke's tifffile.py [1]_, and supports many\n    advanced image types including multi-page and floating point.\n\n    References\n    ----------\n    .. [1] http://www.lfd.uci.edu/~gohlke/code/tifffile.py\n\n    \"\"\"\n\n    if 'img_num' in kwargs:\n        kwargs['key'] = kwargs.pop('img_num')\n\n    # parse_kwargs will extract keyword arguments intended for the TiffFile \n    # class and remove them from the kwargs dictionary in-place\n    tiff_keys = ['multifile', 'multifile_close', 'pages', 'fastij', 'is_ome']\n    kwargs_tiff = parse_kwargs(kwargs, *tiff_keys)\n\n    # read and return tiff as numpy array\n    with TiffFile(fname, **kwargs_tiff) as tif:\n        return tif.asarray(**kwargs)\n", "path": "skimage/io/_plugins/tifffile_plugin.py"}]}