[scikit-learn] error from import sklearn

Lifan Xu xulifan at udel.edu
Fri Jul 29 14:12:33 EDT 2016


Hi,

I found the problem was caused by another python source file named
"opcode.py". Because python2.7 also has a source file named "opcode.py"

If I rename my file to "opcode_extract.py", then problem solved.

Thanks.

On Fri, Jul 29, 2016 at 10:32 AM, Andreas Mueller <t3kcit at gmail.com> wrote:

> 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 listscikit-learn at python.orghttps://mail.python.org/mailman/listinfo/scikit-learn
>
>
>
> _______________________________________________
> 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/e501d37b/attachment.html>


More information about the scikit-learn mailing list