-3

When i try to run titanic.py script of TensorFlow and Scikit Flow example on TensorFlow i got this error:

Traceback (most recent call last):
  File "titanic.py", line 10, in <module>
    import skflow
  File "build/bdist.linux-x86_64/egg/skflow/__init__.py", line 20, in <module>
  File "build/bdist.linux-x86_64/egg/skflow/estimators/__init__.py", line 16, in <module>
  File "build/bdist.linux-x86_64/egg/skflow/estimators/base.py", line 25, in <module>
ImportError: cannot import name NotFittedError

I am using pip, python 2.7.9 and Ubuntu 15

Can anyone please help me to solve this error?

mrry
  • 125,488
  • 26
  • 399
  • 400
Zuhair Mirza
  • 127
  • 3
  • 12
  • Do you need to repost the essentially same installation problem every day? http://stackoverflow.com/questions/33875887/tensorflow-installation-on-ubuntu http://stackoverflow.com/questions/33853713/tensorflow-installation-on-ubuntu-14-04-lts – Has QUIT--Anony-Mousse Dec 22 '15 at 15:11
  • I think this is a legitimate bug in skflow. I've opened a GitHub issue to track it: https://github.com/google/skflow/issues/47 – mrry Dec 22 '15 at 16:29

3 Answers3

3

EDIT: This has now been fixed in skflow. Upgrading to the latest version of skflow will fix the issue.

The offending import is in skflow/estimators/base.py:

from sklearn.utils.validation import NotFittedError

It looks like this class was moved in a (relatively) recent commit to scikit-learn. It would probably be easiest to downgrade to a previous version of scikit-learn (e.g. the 0.17 release seems to be compatible). If you're feeling adventurous, you could try editing line 25 of "build/bdist.linux-x86_64/egg/skflow/estimators/base.py" to read:

from sklean.exceptions import NotFittedError
mrry
  • 125,488
  • 26
  • 399
  • 400
1

You need to learn to debug such problems yourself.

See: every installation is a bit different. There are hundreds of packages installed, and apparently you have a version conflict. But we do not have access to your computer, and we cannot tell which versions you have installed.

You are missing the import NotFittedError

Now you need to:

  1. find out where it is imported (the error message is very helpful there)
  2. where it is imported from (you need to look at the file on your computer...)
  3. figure out why this is not found
  4. find out when NotFittedError was added or removed

As far as I can tell, your tensorflow version is incompatible with your sklearn version.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
0
pip install --upgrade sklearn

fixed the problem