Repository: scikit-image/scikit-image

Issue:
Failing CI due to circular imports on minimum requirements
## Description

Example failure:

https://github.com/scikit-image/scikit-image/runs/4222383396?check_suite_focus=true#step:5:282

Traceback:

```pytb
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/__init__.py", line 101, in <module>
    submod_attrs={'data': ['data_dir']}
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/_shared/lazy.py", line 76, in attach
    __getattr__(attr)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/_shared/lazy.py", line 62, in __getattr__
    return importlib.import_module(f'{package_name}.{name}')
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/future/__init__.py", line 8, in <module>
    from . import graph
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/future/graph/__init__.py", line 2, in <module>
    from .rag import rag_mean_color, RAG, show_rag, rag_boundary
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/future/graph/rag.py", line 8, in <module>
    from ... import measure, segmentation, util, color
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/segmentation/__init__.py", line 3, in <module>
    from .active_contour_model import active_contour
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/segmentation/active_contour_model.py", line 6, in <module>
    from ..filters import sobel
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/filters/__init__.py", line 28, in <module>
    '_fft_based': ['butterworth']
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/_shared/lazy.py", line 76, in attach
    __getattr__(attr)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/_shared/lazy.py", line 65, in __getattr__
    f'{package_name}.{attr_to_modules[name]}'
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/filters/ridges.py", line 17, in <module>
    from ..feature.corner import hessian_matrix, hessian_matrix_eigvals
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/feature/__init__.py", line 25, in <module>
    from .sift import SIFT
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/feature/sift.py", line 8, in <module>
    from ..filters import gaussian
ImportError: cannot import name 'gaussian' from 'skimage.filters' (/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/skimage/filters/__init__.py)
```

To me it looks like a circular import: sift is trying to import filters.gaussian, but sift itself is being imported when importing filters.ridges. It is completely unclear to me why this would happen only in a minreq environment... Perhaps it's tied to a try/except import based on older/newer versions of a dependency?



Discussion:
We should update that import to be from skimage._shared.filters, but I think that is probably not the only problem as I saw this same kind of failure on a different import (of `rgb2gray` from `color.colorconv`) in a PR yesterday. In that case, it was also only on the mini-req branch where it occurred.

I will try to reproduce it in a local environment.
Ahhh, I see now that this "mini-req" is the only one that has `EAGER_IMPORT=1` set, so that would explain why it only fails on that one. It is probably not related to the versions of the dependencies at all.

Resolving patch:
diff --git a/skimage/exposure/exposure.py b/skimage/exposure/exposure.py
--- a/skimage/exposure/exposure.py
+++ b/skimage/exposure/exposure.py
@@ -1,6 +1,6 @@
 import numpy as np
 
-from ..color.colorconv import rgb2gray, rgba2rgb
+from ..color import rgb2gray, rgba2rgb
 from ..util.dtype import dtype_range, dtype_limits
 from .._shared import utils
 
diff --git a/skimage/feature/sift.py b/skimage/feature/sift.py
--- a/skimage/feature/sift.py
+++ b/skimage/feature/sift.py
@@ -5,7 +5,7 @@
 
 from .._shared.utils import check_nD, _supported_float_type
 from ..feature.util import DescriptorExtractor, FeatureDetector
-from ..filters import gaussian
+from .._shared.filters import gaussian
 from ..transform import rescale
 from ..util import img_as_float
 from ._sift import (_local_max, _ori_distances, _update_histogram)


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -37,7 +37,7 @@ jobs:
             EAGER_IMPORT: 1
             # Test mininum requirements (don't build docs there is a problem
             # with dask and astropy)
-            OPTIONS_NAME: "mini-req"
+            OPTIONS_NAME: "mini-req-eager-import"
           - platform_id: manylinux_x86_64
             python-version: 3.7
             MINIMUM_REQUIREMENTS: 1