为什么第一次导入skimage失败,但是第二次成功?

时间:2019-06-21 20:11:42

标签: python python-2.7 numpy dask scikit-image

当我导入skimage时,收到一条奇怪的错误消息,似乎与scikit-image,numpy和dask的版本不匹配问题有关,但是如果我立即尝试再次导入,一切都很好-即

(base) me@balin:~$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import skimage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/me/anaconda2/lib/python2.7/site-packages/skimage/__init__.py", line 167, in <module>
    from .util.dtype import (img_as_float32,
  File "/home/me/anaconda2/lib/python2.7/site-packages/skimage/util/__init__.py", line 6, in <module>
    from .apply_parallel import apply_parallel
  File "/home/me/anaconda2/lib/python2.7/site-packages/skimage/util/apply_parallel.py", line 8, in <module>
    import dask.array as da
  File "/home/me/anaconda2/lib/python2.7/site-packages/dask/array/__init__.py", line 9, in <module>
    from .routines import (take, choose, argwhere, where, coarsen, insert,
  File "/home/me/anaconda2/lib/python2.7/site-packages/dask/array/routines.py", line 256, in <module>
    @wraps(np.matmul)
  File "/home/me/anaconda2/lib/python2.7/functools.py", line 33, in update_wrapper
    setattr(wrapper, attr, getattr(wrapped, attr))
AttributeError: 'numpy.ufunc' object has no attribute '__module__'
>>> import skimage
>>> 

>>> skimage.__version__
'0.14.2'

>>> import numpy as np
>>> np.__version__
'1.16.2'

>>> import dask
>>> dask.__version__
u'1.0.0'

1 个答案:

答案 0 :(得分:1)

这些dask和numpy版本显然不兼容。有很多关于此的错误报告

https://github.com/scikit-image/scikit-image/issues/3649
https://github.com/scikit-image/scikit-image/issues/3654
https://github.com/scikit-image/scikit-image/issues/3818

解决方案似乎正在更新,所以可以尝试

conda update --no-update-deps dask