TypeError: load() missing 1 required positional argument: 'Loader' when importing felzenszwalb, slic, quickshift, watershed from skimage.segmentation

TypeError: load() missing 1 required positional argument: 'Loader' when importing felzenszwalb, slic, quickshift, watershed from skimage.segmentation

我正在尝试 运行 简单的 test script of skimage for superpixels segmentation。然而,当我执行代码(python -m src)时,我得到了这个错误:

Traceback (most recent call last):
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\runpy.py", line 85, in _run_code  
    exec(code, run_globals)
  File "C:\Users\nicol\Documents\CSA\CV\computer-vision-gan\src\__main__.py", line 8, in <module>
    from src.transformers import (
  File "C:\Users\nicol\Documents\CSA\CV\computer-vision-gan\src\transformers\__init__.py", line 7, in <module>
    from src.transformers.transformers_super_pixels import *
  File "C:\Users\nicol\Documents\CSA\CV\computer-vision-gan\src\transformers\transformers_super_pixels.py", line 3, in <module>
    from skimage.segmentation import slic
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\segmentation\__init__.py", line 2, in <module>
    from .active_contour_model import active_contour
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\segmentation\active_contour_model.py", line 5, in <module>
    from ..filters import sobel
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\filters\__init__.py", line 4, in <module>
    from .edges import (sobel, sobel_h, sobel_v,
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\filters\edges.py", line 18, in <module>
    from ..restoration.uft import laplacian
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\restoration\__init__.py", line 9, in <module>
    from ._cycle_spin import cycle_spin
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\restoration\_cycle_spin.py", line 6, in <module>
    import dask
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\__init__.py", line 3, in <module>
    from . import config, datasets
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 512, in <module>
    refresh()
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 411, in refresh
    update(config, collect(**kwargs))
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 375, in collect
    configs.extend(collect_yaml(paths=paths))
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 168, in collect_yaml
    data = yaml.load(f.read()) or {}
TypeError: load() missing 1 required positional argument: 'Loader'
make: *** [Makefile:7: run] Error 1
(cvProject) PS C:\Users\nicol\Documents\CSA\CV\computer-vision-gan> python -m src 
Traceback (most recent call last):
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\runpy.py", line 85, in _run_code  
    exec(code, run_globals)
  File "C:\Users\nicol\Documents\CSA\CV\computer-vision-gan\src\__main__.py", line 8, in <module>
    from src.transformers import (
  File "C:\Users\nicol\Documents\CSA\CV\computer-vision-gan\src\transformers\__init__.py", line 7, in <module>
    from src.transformers.transformers_super_pixels import *
  File "C:\Users\nicol\Documents\CSA\CV\computer-vision-gan\src\transformers\transformers_super_pixels.py", line 3, in <module>
    from skimage.segmentation import slic
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\segmentation\__init__.py", line 2, in <module>
    from .active_contour_model import active_contour
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\segmentation\active_contour_model.py", line 5, in <module>
    from ..filters import sobel
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\filters\__init__.py", line 4, in <module>
    from .edges import (sobel, sobel_h, sobel_v,
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\filters\edges.py", line 18, in <module>
    from ..restoration.uft import laplacian
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\restoration\__init__.py", line 9, in <module>
    from ._cycle_spin import cycle_spin
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\skimage\restoration\_cycle_spin.py", line 6, in <module>
    import dask
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\__init__.py", line 3, in <module>
    from . import config, datasets
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 512, in <module>
    refresh()
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 411, in refresh
    update(config, collect(**kwargs))
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 375, in collect
    configs.extend(collect_yaml(paths=paths))
  File "C:\Users\nicol\anaconda3\envs\cvProject\lib\site-packages\dask\config.py", line 168, in collect_yaml
    data = yaml.load(f.read()) or {}
TypeError: load() missing 1 required positional argument: 'Loader'

我的 conda 环境是从这个 requirements.txt 文件安装的:

opencv-python==4.5.4.60
nptyping==1.4.4
numpy===1.21.3
tqdm==4.62.3
matplotlib==3.3.2
pandas==1.3.5
scikit-image==0.17.2

如何解决这个错误?

似乎错误来自 dask 软件包版本(参见 link to github package issue fix)。 因此需要安装distributed=2022.01.0.

pip install distributed=2022.01.0