Import error when importing from skimage.transform

2,621 views
Skip to first unread message

sja...@nyu.edu

unread,
Jun 23, 2016, 8:30:36 PM6/23/16
to scikit-image
The environment I'm using is a Jupyter notebook running python 3.5. I can import other packages, but importing anything from skimage.transform results in the following error:

ImportError                               Traceback (most recent call last)
<ipython-input-19-741b6a154664> in <module>()
----> 1 from skimage.transform import resize

/home/jupyter/anaconda3/envs/py35/lib/python3.5/site-packages/skimage/transform/__init__.py in <module>()
----> 1 from .hough_transform import (hough_line, hough_line_peaks,
      2                               probabilistic_hough_line, hough_circle,
      3                               hough_ellipse)
      4 from .radon_transform import radon, iradon, iradon_sart
      5 from .finite_radon_transform import frt2, ifrt2

/home/jupyter/anaconda3/envs/py35/lib/python3.5/site-packages/skimage/transform/hough_transform.py in <module>()
      2 from scipy import ndimage as ndi
      3 from .. import measure
----> 4 from ._hough_transform import (_hough_circle,
      5                                hough_ellipse as _hough_ellipse,
      6                                hough_line as _hough_line,

ImportError: cannot import name '_hough_circle'

We've already tried uninstalling skimage, updating cython and then re-installing. Anyone else encounter this problem?

Juan Nunez-Iglesias

unread,
Jun 24, 2016, 2:31:19 PM6/24/16
to scikit...@googlegroups.com
This usually has to do with an incorrect build of scikit-image. Can you tell us how you "reinstalled" scikit-image? My guess is that you either:

- did not actually compile the Cython files (pyx -> c -> so), or
- compiled in-place but did not install to your Python environment, or
- compiled and installed to Python environment but running from scikit-image source directory, which often causes Python's import machinery to get confused.

If you can give us more details about your Python install and how you're running your notebook, we might be able to help diagnose the problem!

One nice trick to do is:

>>> import skimage
>>> skimage

The output should show you *which* skimage file you are loading when importing.

Juan.

--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/d7a8d058-2202-424e-b6b4-b4cd85c1811e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Barbara Collignon

unread,
Jun 30, 2016, 4:19:56 PM6/30/16
to scikit-image
same issue here with python2.7+

Juan Nunez-Iglesias

unread,
Jul 1, 2016, 10:36:01 AM7/1/16
to scikit...@googlegroups.com
Hi Barbara,

Can you look at my response to the original email and post your results?

Sometimes skimage installs to a path that is *not* the path where Python looks for packages. Or sometimes you install the C extensions to the Python path but then try to import the local copy of scikit-image. It's hard to know what's happening without the diagnostics above...

--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages