Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named 'nose'

I tried to help('modules') and there was no nose module.

I even tried pip install nose, sudo pip install nose, and etc..

When ever I tried to install nose with command line, it will throw out

SyntaxError: invalid syntax.
Traceback (most recent call last):
  File "C:\Python34\plot_cluster_iris.py", line 31, in <module>
    from sklearn.cluster import KMeans
  File "C:\Python34\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module>
    from .spectral import spectral_clustering, SpectralClustering
  File "C:\Python34\lib\site-packages\sklearn\cluster\spectral.py", line 13, in <module>
    from ..utils import check_random_state, as_float_array
  File "C:\Python34\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
    from .validation import (as_float_array, check_arrays, safe_asarray,
  File "C:\Python34\lib\site-packages\sklearn\utils\validation.py", line 17, in <module>
    from .fixes import safe_copy
  File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
    from .testing import ignore_warnings
  File "C:\Python34\lib\site-packages\sklearn\utils\testing.py", line 36, in <module>
    from nose.tools import assert_equal

What should I do?

like image 692
oneplusoneisone Avatar asked Apr 01 '15 22:04

oneplusoneisone


1 Answers

I think your pip3 and python3 versions are mismatched, possibly due to multiple versions of Python 3 installed.

Run pip3 --version to find the exact Python version that pip3 is associated with and the location of site-packages directory.

Then, run python3 and look at the location of site-packages using:

import site
site.getsitepackages()

If you see different directory locations then that's your problem - multiple versions of Python 3. If it is indeed the problem, remove both the versions, re-install the correct one and then install your packages.

I hope this helps!

like image 118
Abhinav Sood Avatar answered Nov 12 '22 11:11

Abhinav Sood