Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named nose.tools

I encounter some difficulties loading dataset onto my programme. I am unsure of the import error as stated below.

Traceback (most recent call last):
  File "C:\Users\Khoo Family\Downloads\lsa_clustering (3).py", line 4, in <module>
    from sklearn.datasets import fetch_20newsgroups
  File "C:\Python27\lib\site-packages\sklearn\datasets\__init__.py", line 7, in <module>
    from .base import load_diabetes
  File "C:\Python27\lib\site-packages\sklearn\datasets\base.py", line 25, in <module>
    from ..utils import check_random_state
  File "C:\Python27\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
    from .validation import (as_float_array, check_arrays, safe_asarray,
  File "C:\Python27\lib\site-packages\sklearn\utils\validation.py", line 17, in <module>
    from .fixes import safe_copy
  File "C:\Python27\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
    from .testing import ignore_warnings
  File "C:\Python27\lib\site-packages\sklearn\utils\testing.py", line 36, in <module>
    from nose.tools import assert_equal
ImportError: No module named nose.tools
like image 634
PANG SEOK MUN S4-02 Avatar asked Aug 20 '14 07:08

PANG SEOK MUN S4-02


1 Answers

Check if nose in a list of installed python packages. You can do it in python console (windows + R, type cmd then enter, type python then enter):

>>> help('modules')

If nose is there, then you either have a problem with PYTHONPATH when running your code or you using another interpreter to run console and your code.

If nose not in a list, do in your console (windows + R, type cmd, then enter):

pip install nose
like image 165
Artem Fedosov Avatar answered Sep 28 '22 07:09

Artem Fedosov