We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
0.14.2 test suite fails with `NameError: global name 'osp'`
## Description

The test suite does not pass. As far as I know `osp` is a common alias for `os.path`. Is this a typo in the code? Or related to the base python version?

## Way to reproduce
```python
pytest -vv
```

## Version information
```python
2.7.16 (default, Mar  4 2019, 19:30:43) 
[GCC 8.2.0]
Linux-4.20.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6
scikit-image version: 0.14.2
numpy version: 1.16.1
```
OR
```python
3.6.8 (default, Mar  4 2019, 19:32:41) 
[GCC 8.2.0]
Linux-4.20.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6
scikit-image version: 0.14.2
numpy version: 1.16.1
```
## My output
[build.log](https://github.com/scikit-image/scikit-image/files/2937545/build.log)




--- 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/__init__.py`
Content:
```
1 """Image Processing SciKit (Toolbox for SciPy)
2 
3 ``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image
4 processing and computer vision.
5 
6 The main package of ``skimage`` only provides a few utilities for converting
7 between image data types; for most features, you need to import one of the
8 following subpackages:
9 
10 Subpackages
11 -----------
12 color
13     Color space conversion.
14 data
15     Test images and example data.
16 draw
17     Drawing primitives (lines, text, etc.) that operate on NumPy arrays.
18 exposure
19     Image intensity adjustment, e.g., histogram equalization, etc.
20 feature
21     Feature detection and extraction, e.g., texture analysis corners, etc.
22 filters
23     Sharpening, edge finding, rank filters, thresholding, etc.
24 graph
25     Graph-theoretic operations, e.g., shortest paths.
26 io
27     Reading, saving, and displaying images and video.
28 measure
29     Measurement of image properties, e.g., similarity and contours.
30 morphology
31     Morphological operations, e.g., opening or skeletonization.
32 novice
33     Simplified interface for teaching purposes.
34 restoration
35     Restoration algorithms, e.g., deconvolution algorithms, denoising, etc.
36 segmentation
37     Partitioning an image into multiple regions.
38 transform
39     Geometric and other transforms, e.g., rotation or the Radon transform.
40 util
41     Generic utilities.
42 viewer
43     A simple graphical user interface for visualizing results and exploring
44     parameters.
45 
46 Utility Functions
47 -----------------
48 img_as_float
49     Convert an image to floating point format, with values in [0, 1].
50     Is similar to `img_as_float64`, but will not convert lower-precision
51     floating point arrays to `float64`.
52 img_as_float32
53     Convert an image to single-precision (32-bit) floating point format,
54     with values in [0, 1].
55 img_as_float64
56     Convert an image to double-precision (64-bit) floating point format,
57     with values in [0, 1].
58 img_as_uint
59     Convert an image to unsigned integer format, with values in [0, 65535].
60 img_as_int
61     Convert an image to signed integer format, with values in [-32768, 32767].
62 img_as_ubyte
63     Convert an image to unsigned byte format, with values in [0, 255].
64 img_as_bool
65     Convert an image to boolean format, with values either True or False.
66 dtype_limits
67     Return intensity limits, i.e. (min, max) tuple, of the image's dtype.
68 
69 """
70 
71 import imp
72 import functools
73 import warnings
74 import sys
75 
76 __version__ = '0.14.3'
77 
78 
79 try:
80     imp.find_module('pytest')
81 except ImportError:
82     def _test(doctest=False, verbose=False):
83         """This would run all unit tests, but pytest couldn't be
84         imported so the test suite can not run.
85         """
86         raise ImportError("Could not load pytest. Unit tests not available.")
87 
88 else:
89     def _test(doctest=False, verbose=False):
90         """Run all unit tests."""
91         import pytest
92         import warnings
93         args = ['--pyargs', 'skimage']
94         if verbose:
95             args.extend(['-v', '-s'])
96         if doctest:
97             args.extend(['--doctest-modules'])
98             # Make sure warnings do not break the doc tests
99             with warnings.catch_warnings():
100                 warnings.simplefilter("ignore")
101                 success = pytest.main(args)
102         else:
103             success = pytest.main(args)
104         # Return sys.exit code
105         if success:
106             return 0
107         else:
108             return 1
109 
110 
111 # do not use `test` as function name as this leads to a recursion problem with
112 # the nose test suite
113 test = _test
114 test_verbose = functools.partial(test, verbose=True)
115 test_verbose.__doc__ = test.__doc__
116 doctest = functools.partial(test, doctest=True)
117 doctest.__doc__ = doctest.__doc__
118 doctest_verbose = functools.partial(test, doctest=True, verbose=True)
119 doctest_verbose.__doc__ = doctest.__doc__
120 
121 
122 # Logic for checking for improper install and importing while in the source
123 # tree when package has not been installed inplace.
124 # Code adapted from scikit-learn's __check_build module.
125 _INPLACE_MSG = """
126 It appears that you are importing a local scikit-image source tree. For
127 this, you need to have an inplace install. Maybe you are in the source
128 directory and you need to try from another location."""
129 
130 _STANDARD_MSG = """
131 Your install of scikit-image appears to be broken.
132 Try re-installing the package following the instructions at:
133 http://scikit-image.org/docs/stable/install.html """
134 
135 
136 def _raise_build_error(e):
137     # Raise a comprehensible error
138     local_dir = osp.split(__file__)[0]
139     msg = _STANDARD_MSG
140     if local_dir == "skimage":
141         # Picking up the local install: this will work only if the
142         # install is an 'inplace build'
143         msg = _INPLACE_MSG
144     raise ImportError("""%s
145 It seems that scikit-image has not been built correctly.
146 %s""" % (e, msg))
147 
148 try:
149     # This variable is injected in the __builtins__ by the build
150     # process. It used to enable importing subpackages of skimage when
151     # the binaries are not built
152     __SKIMAGE_SETUP__
153 except NameError:
154     __SKIMAGE_SETUP__ = False
155 
156 if __SKIMAGE_SETUP__:
157     sys.stderr.write('Partial import of skimage during the build process.\n')
158     # We are not importing the rest of the scikit during the build
159     # process, as it may not be compiled yet
160 else:
161     try:
162         from ._shared import geometry
163         del geometry
164     except ImportError as e:
165         _raise_build_error(e)
166     # All skimage root imports go here
167     from .util.dtype import (img_as_float32,
168                              img_as_float64,
169                              img_as_float,
170                              img_as_int,
171                              img_as_uint,
172                              img_as_ubyte,
173                              img_as_bool,
174                              dtype_limits)
175 
176     from .util.lookfor import lookfor
177     from .data import data_dir
178 
179 
180 del warnings, functools, imp, sys
181
```
--- 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/skimage/__init__.py b/skimage/__init__.py
--- a/skimage/__init__.py
+++ b/skimage/__init__.py
@@ -135,6 +135,7 @@
 
 def _raise_build_error(e):
     # Raise a comprehensible error
+    import os.path as osp
     local_dir = osp.split(__file__)[0]
     msg = _STANDARD_MSG
     if local_dir == "skimage":

{"golden_diff": "diff --git a/skimage/__init__.py b/skimage/__init__.py\n--- a/skimage/__init__.py\n+++ b/skimage/__init__.py\n@@ -135,6 +135,7 @@\n \n def _raise_build_error(e):\n     # Raise a comprehensible error\n+    import os.path as osp\n     local_dir = osp.split(__file__)[0]\n     msg = _STANDARD_MSG\n     if local_dir == \"skimage\":\n", "issue": "0.14.2 test suite fails with `NameError: global name 'osp'`\n## Description\r\n\r\nThe test suite does not pass. As far as I know `osp` is a common alias for `os.path`. Is this a typo in the code? Or related to the base python version?\r\n\r\n## Way to reproduce\r\n```python\r\npytest -vv\r\n```\r\n\r\n## Version information\r\n```python\r\n2.7.16 (default, Mar  4 2019, 19:30:43) \r\n[GCC 8.2.0]\r\nLinux-4.20.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6\r\nscikit-image version: 0.14.2\r\nnumpy version: 1.16.1\r\n```\r\nOR\r\n```python\r\n3.6.8 (default, Mar  4 2019, 19:32:41) \r\n[GCC 8.2.0]\r\nLinux-4.20.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6\r\nscikit-image version: 0.14.2\r\nnumpy version: 1.16.1\r\n```\r\n## My output\r\n[build.log](https://github.com/scikit-image/scikit-image/files/2937545/build.log)\r\n\r\n\r\n\n", "before_files": [{"content": "\"\"\"Image Processing SciKit (Toolbox for SciPy)\n\n``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image\nprocessing and computer vision.\n\nThe main package of ``skimage`` only provides a few utilities for converting\nbetween image data types; for most features, you need to import one of the\nfollowing subpackages:\n\nSubpackages\n-----------\ncolor\n    Color space conversion.\ndata\n    Test images and example data.\ndraw\n    Drawing primitives (lines, text, etc.) that operate on NumPy arrays.\nexposure\n    Image intensity adjustment, e.g., histogram equalization, etc.\nfeature\n    Feature detection and extraction, e.g., texture analysis corners, etc.\nfilters\n    Sharpening, edge finding, rank filters, thresholding, etc.\ngraph\n    Graph-theoretic operations, e.g., shortest paths.\nio\n    Reading, saving, and displaying images and video.\nmeasure\n    Measurement of image properties, e.g., similarity and contours.\nmorphology\n    Morphological operations, e.g., opening or skeletonization.\nnovice\n    Simplified interface for teaching purposes.\nrestoration\n    Restoration algorithms, e.g., deconvolution algorithms, denoising, etc.\nsegmentation\n    Partitioning an image into multiple regions.\ntransform\n    Geometric and other transforms, e.g., rotation or the Radon transform.\nutil\n    Generic utilities.\nviewer\n    A simple graphical user interface for visualizing results and exploring\n    parameters.\n\nUtility Functions\n-----------------\nimg_as_float\n    Convert an image to floating point format, with values in [0, 1].\n    Is similar to `img_as_float64`, but will not convert lower-precision\n    floating point arrays to `float64`.\nimg_as_float32\n    Convert an image to single-precision (32-bit) floating point format,\n    with values in [0, 1].\nimg_as_float64\n    Convert an image to double-precision (64-bit) floating point format,\n    with values in [0, 1].\nimg_as_uint\n    Convert an image to unsigned integer format, with values in [0, 65535].\nimg_as_int\n    Convert an image to signed integer format, with values in [-32768, 32767].\nimg_as_ubyte\n    Convert an image to unsigned byte format, with values in [0, 255].\nimg_as_bool\n    Convert an image to boolean format, with values either True or False.\ndtype_limits\n    Return intensity limits, i.e. (min, max) tuple, of the image's dtype.\n\n\"\"\"\n\nimport imp\nimport functools\nimport warnings\nimport sys\n\n__version__ = '0.14.3'\n\n\ntry:\n    imp.find_module('pytest')\nexcept ImportError:\n    def _test(doctest=False, verbose=False):\n        \"\"\"This would run all unit tests, but pytest couldn't be\n        imported so the test suite can not run.\n        \"\"\"\n        raise ImportError(\"Could not load pytest. Unit tests not available.\")\n\nelse:\n    def _test(doctest=False, verbose=False):\n        \"\"\"Run all unit tests.\"\"\"\n        import pytest\n        import warnings\n        args = ['--pyargs', 'skimage']\n        if verbose:\n            args.extend(['-v', '-s'])\n        if doctest:\n            args.extend(['--doctest-modules'])\n            # Make sure warnings do not break the doc tests\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\")\n                success = pytest.main(args)\n        else:\n            success = pytest.main(args)\n        # Return sys.exit code\n        if success:\n            return 0\n        else:\n            return 1\n\n\n# do not use `test` as function name as this leads to a recursion problem with\n# the nose test suite\ntest = _test\ntest_verbose = functools.partial(test, verbose=True)\ntest_verbose.__doc__ = test.__doc__\ndoctest = functools.partial(test, doctest=True)\ndoctest.__doc__ = doctest.__doc__\ndoctest_verbose = functools.partial(test, doctest=True, verbose=True)\ndoctest_verbose.__doc__ = doctest.__doc__\n\n\n# Logic for checking for improper install and importing while in the source\n# tree when package has not been installed inplace.\n# Code adapted from scikit-learn's __check_build module.\n_INPLACE_MSG = \"\"\"\nIt appears that you are importing a local scikit-image source tree. For\nthis, you need to have an inplace install. Maybe you are in the source\ndirectory and you need to try from another location.\"\"\"\n\n_STANDARD_MSG = \"\"\"\nYour install of scikit-image appears to be broken.\nTry re-installing the package following the instructions at:\nhttp://scikit-image.org/docs/stable/install.html \"\"\"\n\n\ndef _raise_build_error(e):\n    # Raise a comprehensible error\n    local_dir = osp.split(__file__)[0]\n    msg = _STANDARD_MSG\n    if local_dir == \"skimage\":\n        # Picking up the local install: this will work only if the\n        # install is an 'inplace build'\n        msg = _INPLACE_MSG\n    raise ImportError(\"\"\"%s\nIt seems that scikit-image has not been built correctly.\n%s\"\"\" % (e, msg))\n\ntry:\n    # This variable is injected in the __builtins__ by the build\n    # process. It used to enable importing subpackages of skimage when\n    # the binaries are not built\n    __SKIMAGE_SETUP__\nexcept NameError:\n    __SKIMAGE_SETUP__ = False\n\nif __SKIMAGE_SETUP__:\n    sys.stderr.write('Partial import of skimage during the build process.\\n')\n    # We are not importing the rest of the scikit during the build\n    # process, as it may not be compiled yet\nelse:\n    try:\n        from ._shared import geometry\n        del geometry\n    except ImportError as e:\n        _raise_build_error(e)\n    # All skimage root imports go here\n    from .util.dtype import (img_as_float32,\n                             img_as_float64,\n                             img_as_float,\n                             img_as_int,\n                             img_as_uint,\n                             img_as_ubyte,\n                             img_as_bool,\n                             dtype_limits)\n\n    from .util.lookfor import lookfor\n    from .data import data_dir\n\n\ndel warnings, functools, imp, sys\n", "path": "skimage/__init__.py"}], "after_files": [{"content": "\"\"\"Image Processing SciKit (Toolbox for SciPy)\n\n``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image\nprocessing and computer vision.\n\nThe main package of ``skimage`` only provides a few utilities for converting\nbetween image data types; for most features, you need to import one of the\nfollowing subpackages:\n\nSubpackages\n-----------\ncolor\n    Color space conversion.\ndata\n    Test images and example data.\ndraw\n    Drawing primitives (lines, text, etc.) that operate on NumPy arrays.\nexposure\n    Image intensity adjustment, e.g., histogram equalization, etc.\nfeature\n    Feature detection and extraction, e.g., texture analysis corners, etc.\nfilters\n    Sharpening, edge finding, rank filters, thresholding, etc.\ngraph\n    Graph-theoretic operations, e.g., shortest paths.\nio\n    Reading, saving, and displaying images and video.\nmeasure\n    Measurement of image properties, e.g., similarity and contours.\nmorphology\n    Morphological operations, e.g., opening or skeletonization.\nnovice\n    Simplified interface for teaching purposes.\nrestoration\n    Restoration algorithms, e.g., deconvolution algorithms, denoising, etc.\nsegmentation\n    Partitioning an image into multiple regions.\ntransform\n    Geometric and other transforms, e.g., rotation or the Radon transform.\nutil\n    Generic utilities.\nviewer\n    A simple graphical user interface for visualizing results and exploring\n    parameters.\n\nUtility Functions\n-----------------\nimg_as_float\n    Convert an image to floating point format, with values in [0, 1].\n    Is similar to `img_as_float64`, but will not convert lower-precision\n    floating point arrays to `float64`.\nimg_as_float32\n    Convert an image to single-precision (32-bit) floating point format,\n    with values in [0, 1].\nimg_as_float64\n    Convert an image to double-precision (64-bit) floating point format,\n    with values in [0, 1].\nimg_as_uint\n    Convert an image to unsigned integer format, with values in [0, 65535].\nimg_as_int\n    Convert an image to signed integer format, with values in [-32768, 32767].\nimg_as_ubyte\n    Convert an image to unsigned byte format, with values in [0, 255].\nimg_as_bool\n    Convert an image to boolean format, with values either True or False.\ndtype_limits\n    Return intensity limits, i.e. (min, max) tuple, of the image's dtype.\n\n\"\"\"\n\nimport imp\nimport functools\nimport warnings\nimport sys\n\n__version__ = '0.14.2'\n\n\ntry:\n    imp.find_module('pytest')\nexcept ImportError:\n    def _test(doctest=False, verbose=False):\n        \"\"\"This would run all unit tests, but pytest couldn't be\n        imported so the test suite can not run.\n        \"\"\"\n        raise ImportError(\"Could not load pytest. Unit tests not available.\")\n\nelse:\n    def _test(doctest=False, verbose=False):\n        \"\"\"Run all unit tests.\"\"\"\n        import pytest\n        import warnings\n        args = ['--pyargs', 'skimage']\n        if verbose:\n            args.extend(['-v', '-s'])\n        if doctest:\n            args.extend(['--doctest-modules'])\n            # Make sure warnings do not break the doc tests\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\")\n                success = pytest.main(args)\n        else:\n            success = pytest.main(args)\n        # Return sys.exit code\n        if success:\n            return 0\n        else:\n            return 1\n\n\n# do not use `test` as function name as this leads to a recursion problem with\n# the nose test suite\ntest = _test\ntest_verbose = functools.partial(test, verbose=True)\ntest_verbose.__doc__ = test.__doc__\ndoctest = functools.partial(test, doctest=True)\ndoctest.__doc__ = doctest.__doc__\ndoctest_verbose = functools.partial(test, doctest=True, verbose=True)\ndoctest_verbose.__doc__ = doctest.__doc__\n\n\n# Logic for checking for improper install and importing while in the source\n# tree when package has not been installed inplace.\n# Code adapted from scikit-learn's __check_build module.\n_INPLACE_MSG = \"\"\"\nIt appears that you are importing a local scikit-image source tree. For\nthis, you need to have an inplace install. Maybe you are in the source\ndirectory and you need to try from another location.\"\"\"\n\n_STANDARD_MSG = \"\"\"\nYour install of scikit-image appears to be broken.\nTry re-installing the package following the instructions at:\nhttp://scikit-image.org/docs/stable/install.html \"\"\"\n\n\ndef _raise_build_error(e):\n    # Raise a comprehensible error\n    import os.path as osp\n    local_dir = osp.split(__file__)[0]\n    msg = _STANDARD_MSG\n    if local_dir == \"skimage\":\n        # Picking up the local install: this will work only if the\n        # install is an 'inplace build'\n        msg = _INPLACE_MSG\n    raise ImportError(\"\"\"%s\nIt seems that scikit-image has not been built correctly.\n%s\"\"\" % (e, msg))\n\ntry:\n    # This variable is injected in the __builtins__ by the build\n    # process. It used to enable importing subpackages of skimage when\n    # the binaries are not built\n    __SKIMAGE_SETUP__\nexcept NameError:\n    __SKIMAGE_SETUP__ = False\n\nif __SKIMAGE_SETUP__:\n    sys.stderr.write('Partial import of skimage during the build process.\\n')\n    # We are not importing the rest of the scikit during the build\n    # process, as it may not be compiled yet\nelse:\n    try:\n        from ._shared import geometry\n        del geometry\n    except ImportError as e:\n        _raise_build_error(e)\n    # All skimage root imports go here\n    from .util.dtype import (img_as_float32,\n                             img_as_float64,\n                             img_as_float,\n                             img_as_int,\n                             img_as_uint,\n                             img_as_ubyte,\n                             img_as_bool,\n                             dtype_limits)\n\n    from .util.lookfor import lookfor\n    from .data import data_dir\n\n\ndel warnings, functools, imp, sys\n", "path": "skimage/__init__.py"}]}