beleidy/unsupervised-image-clustering

ImportError: cannot import name 'indexable'

maky-hnou opened this issue · 1 comments

I don't use Jupyter, so when I copied the whole code (except the lines that are destined to work with Jupyter) to a python file and I run it in an environment where all the needed packages are installed (cv2, keras, matplotlib, numpy, pandas, sklearn, tensorflow), I got this error:

Using TensorFlow backend.
Traceback (most recent call last):
  File "pydoc.py", line 9, in <module>
    from sklearn.model_selection import train_test_split
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/__init__.py", line 64, in <module>
    from .base import clone
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/base.py", line 13, in <module>
    from .utils.fixes import signature
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/utils/__init__.py", line 13, in <module>
    from .validation import (as_float_array,
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/utils/validation.py", line 27, in <module>
    from ..utils._joblib import Memory
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/utils/_joblib.py", line 18, in <module>
    from ..externals.joblib import __all__   # noqa
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/externals/joblib/__init__.py", line 112, in <module>
    from .memory import Memory, MemorizedResult, register_store_backend
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/externals/joblib/memory.py", line 15, in <module>
    import pydoc
  File "/home/hani/Desktop/unsupervised-image-clustering/pydoc.py", line 9, in <module>
    from sklearn.model_selection import train_test_split
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/model_selection/__init__.py", line 1, in <module>
    from ._split import BaseCrossValidator
  File "/home/hani/.virtualenvs/Docdet/lib/python3.6/site-packages/sklearn/model_selection/_split.py", line 24, in <module>
    from ..utils import indexable, check_random_state, safe_indexing
ImportError: cannot import name 'indexable'

I googled that, but I didn't find any solution.
Is it something related to the sklearn library or to the code?

I figured out that it was an error related to a filename, I renamed it and it is working fine.