Scikit-image: Cannot find rgb2gray though scikit-image 0.14 is installed

Created on 15 Jul 2018  路  3Comments  路  Source: scikit-image/scikit-image

Hi there,

I'm on the way for some Tensorflow image data learning for satellite data, hence scikit-image is quite useful. However, I've got an issue as it claims to not find rgb2gray. What could be the matter?

import numpy as np # linear algebra 
import tensorflow as tf # Tensorflow
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt # visualize satellite images
from skimage.io import imshow # visualize satellite images

keras.layers import Dense, Conv2D, MaxPooling2D, Flatten, Dropout # components of network
from keras.models import Sequential # type of model

Reply is this search path, ending with the demand for rgy2gray:

ImportError                               Traceback (most recent call last)
<ipython-input-9-fa694fe3d61f> in <module>()
      3 import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
      4 import matplotlib.pyplot as plt # visualize satellite images
----> 5 from skimage.io import imshow # visualize satellite images
      6 
      7 from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten, Dropout # components of network

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\io\__init__.py in <module>()
      9 from .collection import *
     10 
---> 11 from ._io import *
     12 from ._image_stack import *
     13 

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\io\_io.py in <module>()
      3 
      4 from ..io.manage_plugins import call_plugin
----> 5 from ..color import rgb2gray
      6 from .util import file_or_url_context
      7 from ..exposure import is_low_contrast

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\color\__init__.py in <module>()
----> 1 from .colorconv import (convert_colorspace,
      2                         guess_spatial_dimensions,
      3                         rgba2rgb,
      4                         rgb2hsv,
      5                         hsv2rgb,

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\color\colorconv.py in <module>()
     58 import numpy as np
     59 from scipy import linalg
---> 60 from ..util import dtype, dtype_limits
     61 
     62 

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\util\__init__.py in <module>()
     10 from .unique import unique_rows
     11 from ._invert import invert
---> 12 from ._montage import montage, montage2d
     13 
     14 from .._shared.utils import copy_func

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\util\_montage.py in <module>()
      1 import numpy as np
----> 2 from .. import exposure
      3 from .._shared.utils import deprecated
      4 
      5 

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\exposure\__init__.py in <module>()
----> 1 from .exposure import histogram, equalize_hist, \
      2                       rescale_intensity, cumulative_distribution, \
      3                       adjust_gamma, adjust_sigmoid, adjust_log, \
      4                       is_low_contrast
      5 

~\Anaconda3\envs\tensorflow\lib\site-packages\skimage\exposure\exposure.py in <module>()
      2 import numpy as np
      3 
----> 4 from ..color import rgb2gray
      5 from ..util.dtype import dtype_range, dtype_limits
      6 from .._shared.utils import warn

ImportError: cannot import name 'rgb2gray'

Most helpful comment

Oh, screw it--.--. Restarting the Kernel on Jupyter is the whole solution. 6hrs lost and it would've just been two clicks. However, thanks for the support. Case closed.

All 3 comments

This looks like a circular import; it actually touches the correct file colorconv.py fairly early on, then bounces around the package before eventually trying to return. Once Python sees one full circle of this, it errors. However, I don't get a circular import when running from skimage.io import imshow.

What version of scikit-image are you running? Check with import skimage; print(skimage.__version__).

Hi JDWarner,

it's 0.14.0.

Oh, screw it--.--. Restarting the Kernel on Jupyter is the whole solution. 6hrs lost and it would've just been two clicks. However, thanks for the support. Case closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FirefoxMetzger picture FirefoxMetzger  路  4Comments

odoublewen picture odoublewen  路  3Comments

robbibt picture robbibt  路  3Comments

jni picture jni  路  4Comments

tirthajyoti picture tirthajyoti  路  3Comments