import error when I test scikit on ubuntu12.04
Question: I want to install scikit on ubuntu12.04 and I followed the instruction on [the
official installing documentation](http://scikit-
learn.org/stable/install.html)and type the following command in the bash: sudo
apt-get install python-sklearn

next I type the test instruction nosetests sklearn --exe

But I got many import errors! I searched google but found little useful links.
I'm new to python and I want to learn python and machine learning through
scikit.So please help me, thank you.

Below are the error information when I run the nosetests command in bash.Due
to the length limitation, I deleted some error.

    
    
      EEEEEE..............EE.....EE........EE.............EEE......EE..........
    ======================================================================
    ERROR: Failure: ImportError (No module named joblib)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/cluster/__init__.py", line 10, in <module>
        from .hierarchical import ward_tree, Ward, WardAgglomeration
      File "/usr/lib/pymodules/python2.7/sklearn/cluster/hierarchical.py", line 20, in <module>
        from ..externals.joblib import Memory
      File "/usr/lib/pymodules/python2.7/sklearn/externals/joblib/__init__.py", line 3, in <module>
        from joblib import *
    ImportError: No module named joblib
    
    ======================================================================
    ERROR: Failure: ImportError (No module named joblib)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/covariance/__init__.py", line 14, in <module>
        from .graph_lasso_ import graph_lasso, GraphLasso, GraphLassoCV
      File "/usr/lib/pymodules/python2.7/sklearn/covariance/graph_lasso_.py", line 20, in <module>
        from ..linear_model import lars_path
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/__init__.py", line 16, in <module>
        from .least_angle import Lars, LassoLars, lars_path, LARS, LassoLARS, \
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/least_angle.py", line 19, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
      File "/usr/lib/pymodules/python2.7/sklearn/externals/joblib/__init__.py", line 3, in <module>
        from joblib import *
    ImportError: No module named joblib
    
    ======================================================================
    ERROR: Failure: ImportError (No module named joblib)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
      File "/usr/lib/pymodules/python2.7/sklearn/externals/joblib/__init__.py", line 3, in <module>
        from joblib import *
    ImportError: No module named joblib
    
    
    ======================================================================
    ERROR: Failure: ImportError (No module named joblib)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/externals/joblib/__init__.py", line 3, in <module>
        from joblib import *
    ImportError: No module named joblib
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Parallel)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/feature_extraction/tests/test_text.py", line 10, in <module>
        from sklearn.grid_search import GridSearchCV
      File "/usr/lib/pymodules/python2.7/sklearn/grid_search.py", line 18, in <module>
        from .cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Parallel)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/feature_selection/__init__.py", line 17, in <module>
        from .rfe import RFE
      File "/usr/lib/pymodules/python2.7/sklearn/feature_selection/rfe.py", line 13, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Parallel)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/__init__.py", line 16, in <module>
        from .least_angle import Lars, LassoLars, lars_path, LARS, LassoLARS, \
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/least_angle.py", line 19, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/metrics/cluster/tests/test_unsupervised.py", line 3, in <module>
        from .... import datasets
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/metrics/tests/test_metrics.py", line 10, in <module>
        from ... import datasets
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/utils/tests/test_sparsefuncs.py", line 5, in <module>
        from sklearn.datasets import make_classification
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/utils/tests/test_svd.py", line 12, in <module>
        from sklearn.datasets.samples_generator import make_low_rank_matrix
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    ERROR: Tests that clone creates a correct deep copy.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_base.py", line 48, in test_clone
        from sklearn.feature_selection import SelectFpr, f_classif
      File "/usr/lib/pymodules/python2.7/sklearn/feature_selection/__init__.py", line 17, in <module>
        from .rfe import RFE
      File "/usr/lib/pymodules/python2.7/sklearn/feature_selection/rfe.py", line 13, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Tests that clone doesn't copy everything.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_base.py", line 64, in test_clone_2
        from sklearn.feature_selection import SelectFpr, f_classif
      File "/usr/lib/pymodules/python2.7/sklearn/feature_selection/__init__.py", line 17, in <module>
        from .rfe import RFE
      File "/usr/lib/pymodules/python2.7/sklearn/feature_selection/rfe.py", line 13, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: sklearn.tests.test_base.test_is_classifier
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_base.py", line 109, in test_is_classifier
        from ..svm import SVC
      File "/usr/lib/pymodules/python2.7/sklearn/svm/__init__.py", line 13, in <module>
        from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC
      File "/usr/lib/pymodules/python2.7/sklearn/svm/classes.py", line 2, in <module>
        from ..linear_model.base import CoefSelectTransformerMixin
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/__init__.py", line 16, in <module>
        from .least_angle import Lars, LassoLars, lars_path, LARS, LassoLARS, \
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/least_angle.py", line 19, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_cross_validation.py", line 10, in <module>
        from ..datasets import make_regression
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Parallel)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_grid_search.py", line 12, in <module>
        from sklearn.grid_search import GridSearchCV
      File "/usr/lib/pymodules/python2.7/sklearn/grid_search.py", line 18, in <module>
        from .cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_hmm.py", line 6, in <module>
        from sklearn.datasets.samples_generator import make_spd_matrix
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Parallel)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_multiclass.py", line 13, in <module>
        from sklearn.svm import LinearSVC
      File "/usr/lib/pymodules/python2.7/sklearn/svm/__init__.py", line 13, in <module>
        from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC
      File "/usr/lib/pymodules/python2.7/sklearn/svm/classes.py", line 2, in <module>
        from ..linear_model.base import CoefSelectTransformerMixin
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/__init__.py", line 16, in <module>
        from .least_angle import Lars, LassoLars, lars_path, LARS, LassoLARS, \
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/least_angle.py", line 19, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Parallel)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_pipeline.py", line 9, in <module>
        from ..svm import SVC
      File "/usr/lib/pymodules/python2.7/sklearn/svm/__init__.py", line 13, in <module>
        from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC
      File "/usr/lib/pymodules/python2.7/sklearn/svm/classes.py", line 2, in <module>
        from ..linear_model.base import CoefSelectTransformerMixin
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/__init__.py", line 16, in <module>
        from .least_angle import Lars, LassoLars, lars_path, LARS, LassoLARS, \
      File "/usr/lib/pymodules/python2.7/sklearn/linear_model/least_angle.py", line 19, in <module>
        from ..cross_validation import check_cv
      File "/usr/lib/pymodules/python2.7/sklearn/cross_validation.py", line 21, in <module>
        from .externals.joblib import Parallel, delayed
    ImportError: cannot import name Parallel
    
    ======================================================================
    ERROR: Failure: ImportError (cannot import name Memory)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_pls.py", line 3, in <module>
        from sklearn.datasets import load_linnerud
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/__init__.py", line 18, in <module>
        from .lfw import load_lfw_pairs
      File "/usr/lib/pymodules/python2.7/sklearn/datasets/lfw.py", line 34, in <module>
        from ..externals.joblib import Memory
    ImportError: cannot import name Memory
    
    ======================================================================
    FAIL: Test either above import has failed for some reason
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/usr/lib/pymodules/python2.7/sklearn/tests/test_init.py", line 22, in test_import_skl
        assert_equal(_top_import_error, None)
    AssertionError: ImportError('cannot import name Parallel',) != None
    
    ----------------------------------------------------------------------
    Ran 100 tests in 6.478s
    
    FAILED (errors=26, failures=1)
    


Answer: Check if the `python-joblib` package is installed

    
    
    sudo dpkg -l | grep joblib
    

If nothing is returned, try running

    
    
    apt-cache search joblib
    

there should be a package named `python-joblib`: install it using

    
    
    sudo apt-get install python-joblib
    

and retry.

**EDIT** :

You are right, that package is installed, but Python seems unable to find it
(proved by your `import joblib` fail). Normally this means that the path where
the package has been installed is not part of the Python's search path.

What you can do is either manually install the module from the source and
specify the path (which seems to be `/usr/lib/python2.7`), or use a tool such
as `easy_install` or `pip` to do that for you.

As stated in your guide, `pip install -U scikit-learn` or `easy_install -U
scikit-learn` should do the trick for you, since your libraries are already
there...

