Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ImportError with numpy 1.10.2 #6115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AndreRoehrig opened this issue Jan 5, 2016 · 12 comments
Closed

ImportError with numpy 1.10.2 #6115

AndreRoehrig opened this issue Jan 5, 2016 · 12 comments

Comments

@AndreRoehrig
Copy link

The issue goes away when numpy 1.10.1 is used (and scipy 0.17 reinstalled).

Traceback (most recent call last):
  File "eval.py", line 2, in <module>
    from sklearn import metrics
  File "/home/andre/test_api/env/lib/python3.5/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/home/andre/test_api/env/lib/python3.5/site-packages/sklearn/base.py", line 11, in <module>
    from .utils.fixes import signature
  File "/home/andre/test_api/env/lib/python3.5/site-packages/sklearn/utils/__init__.py", line 11, in <module>
    from .validation import (as_float_array,
  File "/home/andre/test_api/env/lib/python3.5/site-packages/sklearn/utils/validation.py", line 16, in <module>
    from ..utils.fixes import signature
  File "/home/andre/test_api/env/lib/python3.5/site-packages/sklearn/utils/fixes.py", line 324, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr
  File "/home/andre/test_api/env/lib/python3.5/site-packages/scipy/sparse/linalg/__init__.py", line 110, in <module>
    from .dsolve import *
  File "/home/andre/test_api/env/lib/python3.5/site-packages/scipy/sparse/linalg/dsolve/__init__.py", line 60, in <module>
    from .linsolve import *
  File "/home/andre/test_api/env/lib/python3.5/site-packages/scipy/sparse/linalg/dsolve/linsolve.py", line 10, in <module>
    from . import _superlu
ImportError: /home/andre/test_api/env/lib/python3.5/site-packages/scipy/sparse/linalg/dsolve/_superlu.cpython-35m-x86_64-linux-gnu.so: undefined symbol: dtrsm_
@lesteve
Copy link
Member

lesteve commented Jan 6, 2016

If you look carefully at your stacktrace this looks like a scipy problem, you should be able to reproduce it just using from scipy.sparse.linalg import lsqr as sparse_lsqr.

Try uninstalling + reinstalling scipy.

@AndreRoehrig
Copy link
Author

Yes, as I mentioned reinstalling scipy with numpy 1.10.1 solves this. The issue is, why is this so and (because this seems to be an issue for scipy) should there be a hint to use sklearn with numpy 1.10.1 (or maybe i just haven't found it)?

@lesteve
Copy link
Member

lesteve commented Jan 6, 2016

Sorry, I am going to try to be clearer:

  • the problem you are encountering seems, with a probability very close to one, to be a scipy install problem on your machine.
  • scipy and for that matter scikit-learn works fine with numpy 1.10.2 to the best of my knowledge.

The advice I was trying to give you was to try uninstalling + reinstalling scipy while keeping numpy 1.10.2, for example if you use conda (if you use pip replace conda by pip in the instructions):

conda uninstall scipy
conda install scipy

@AndreRoehrig
Copy link
Author

Still the same problem with numpy 1.10.2 .
A different user on a different machine and os (i use arch) had the same problem:

http://askubuntu.com/questions/712485/installing-scikit-learn-with-python3-superlu-cpython-34m-so-undefined-symbol

@lesteve
Copy link
Member

lesteve commented Jan 6, 2016

Still the same problem with numpy 1.10.2 .
A different user on a different machine and os (i use arch) had the same problem:

Fair enough, it may be a genuine problem, hard to tell. I didn't manage to reproduce this in a fresh conda environment using pip install scipy. In any case this seems like a scipy specific problem and the scikit-learn bug tracker may not be the best place to discuss it.

For the record I am using conda and I don't seem to be affected by this issue.

@sgargbugreporter
Copy link

I get the same issue with numpy 1.10.4 + scipy 0.16.1

Downgrading numpy to 1.10.1 & reinstalling scipy solves this:

$ sudo pip install numpy==1.10.1
$ sudo pip install --upgrade --force-reinstall scipy
$ uname -a
Linux 4.3.3-2-ARCH #1 SMP PREEMPT Wed Dec 23 20:09:18 CET 2015 x86_64 GNU/Linux

@GaelVaroquaux
Copy link
Member

To me, that looks very much like a binary incompatibility problem.

In other terms, I believe that you are installing various packages from
different sources that have not been compiled to work together. This is
why Sachin Garg has solved this problem by forcing recompilations.

@amueller
Copy link
Member

So are you compiling numpy and scipy from source? That is not really recommended (also per our documentation). I'd recommend using your package manager or conda instead.

As the error is in scipy and not scikit-learn, I'm closing.

@lesteve
Copy link
Member

lesteve commented Jan 20, 2016

As the error is in scipy and not scikit-learn, I'm closing.

I agree on this one.

FWIW I tried to reproduce the problem on an ArchLinux distro within VirtualBox since both @AndreRoehrig and @sgargbugreporter seemed to have the problem on Arch. I wasn't able to reproduce the problem.

@amueller
Copy link
Member

btw try from scipy.sparse.linalg import lsqr as sparse_lsqr to see that it is a scipy issue.

@fkraus
Copy link

fkraus commented Jan 27, 2016

I had to also add --no-cache-dir when re-installing scipy

@sciunto
Copy link

sciunto commented Feb 2, 2016

I experienced the same issue and I made a report to scipy as it's definitely not the right place here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants