[scikit-learn] error from import sklearn

Andreas Mueller t3kcit at gmail.com
Fri Jul 29 10:32:07 EDT 2016


Hi Lifan.
It looks like there's something wrong with your scipy installation (or 
python installation?)
Can you try

     from scipy.sparse.linalg.interface import aslinearoperator

and

     import dis


Btw, where did you get these installation instructions from?
The Readme?

Best,
Andy



On 07/28/2016 08:50 PM, Lifan Xu wrote:
> Hi guys,
>
>     I am sorry to bother you. But I have a question about using 
> scikit-learn in ubuntu.
>
>     I installed scikit using:
>
>     sudo apt-get install build-essential python-dev python-numpy   
> python-numpy-dev python-scipy libatlas-dev g++ python-matplotlib   ipython
>     sudo pip install -U scikit-learn
>
>     However, when I try to use scikit, I got this error:
>
>
> Python 2.7.6 (default, Jun 22 2015, 17:58:13)
>
> [GCC 4.8.2] on linux2
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from sklearn import datasets
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
>   File "/usr/local/lib/python2.7/dist-packages/sklearn/__init__.py", 
> line 57, in <module>
>
>     from .base import clone
>
>   File "/usr/local/lib/python2.7/dist-packages/sklearn/base.py", line 
> 11, in <module>
>
>     from .utils.fixes import signature
>
>   File 
> "/usr/local/lib/python2.7/dist-packages/sklearn/utils/__init__.py", 
> line 11, in <module>
>
>     from .validation import (as_float_array,
>
>   File 
> "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", 
> line 16, in <module>
>
>     from ..utils.fixes import signature
>
>   File 
> "/usr/local/lib/python2.7/dist-packages/sklearn/utils/fixes.py", line 
> 322, in <module>
>
>     from ._scipy_sparse_lsqr_backport import lsqr as sparse_lsqr
>
>   File 
> "/usr/local/lib/python2.7/dist-packages/sklearn/utils/_scipy_sparse_lsqr_backport.py", 
> line 58, in <module>
>
>     from scipy.sparse.linalg.interface import aslinearoperator
>
>   File 
> "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/__init__.py", 
> line 108, in <module>
>
>     from .isolve import *
>
>   File 
> "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/isolve/__init__.py", 
> line 6, in <module>
>
>     from .iterative import *
>
>   File 
> "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/isolve/iterative.py", 
> line 11, in <module>
>
>     from scipy.lib.decorator import decorator
>
>   File "/usr/lib/python2.7/dist-packages/scipy/lib/decorator.py", line 
> 39, in <module>
>
>     import sys, re, inspect
>
>   File "/usr/lib/python2.7/inspect.py", line 37, in <module>
>
>     import dis
>
>   File "/usr/lib/python2.7/dis.py", line 7, in <module>
>
>     from opcode import __all__ as _opcodes_all
>
> ImportError: cannot import name __all__
>
>
>     Anyone knows how to fix this problem?
>
>     Thanks!
>
>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20160729/68be415d/attachment-0001.html>


More information about the scikit-learn mailing list