2

I'm trying to set up scikit-learn, but after installing numpy and scikit-learn (using pip) that's what I get when trying to imort sklearn:

import sklearn
RuntimeError: module compiled against API version 8 but this version of numpy is 7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/sklearn/__init__.py", line 32, in <module>
  from .base import clone
File "/usr/local/lib/python2.7/site-packages/sklearn/base.py", line 10, in <module>
  from scipy import sparse
File "/Library/Python/2.7/site-packages/scipy-0.13.0.dev_c31f167_20130304-py2.7-macosx-10.8-intel.egg/scipy/sparse/__init__.py", line 182, in <module>
from .csr import *
File "/Library/Python/2.7/site-packages/scipy-0.13.0.dev_c31f167_20130304-py2.7-macosx-10.8-intel.egg/scipy/sparse/csr.py", line 15, in <module>
from .sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
File "/Library/Python/2.7/site-packages/scipy-0.13.0.dev_c31f167_20130304-py2.7-macosx-10.8-intel.egg/scipy/sparse/sparsetools/__init__.py", line 5, in <module>
from .csr import *
File "/Library/Python/2.7/site-packages/scipy-0.13.0.dev_c31f167_20130304-py2.7-macosx-10.8-intel.egg/scipy/sparse/sparsetools/csr.py", line 26, in <module>
_csr = swig_import_helper()
File "/Library/Python/2.7/site-packages/scipy-0.13.0.dev_c31f167_20130304-py2.7-macosx-10.8-intel.egg/scipy/sparse/sparsetools/csr.py", line 22, in swig_import_helper
_mod = imp.load_module('_csr', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import

Tried to reinstall things without success

7
  • 1
    It looks like you have the wrong version of numpy - are you positive you installed the correct one? Commented Mar 7, 2013 at 21:32
  • @thegrinner Well, I have version 7 while the traceback mentions version 8. But is there a numpy 1.8 out there? This sourceforge.net/projects/numpy/files/NumPy confirms that I have the newest one Commented Mar 7, 2013 at 21:36
  • 1
    Hmmm... this github issue suggets 1.7.0b2 should work: github.com/jsalvatier/scikits.bvp_solver/issues/2 I assume you grabbed 1.7.0? Commented Mar 7, 2013 at 21:41
  • Or perhaps it's related to this issue on macports where the system numpy is being prioritized over the new version: trac.macports.org/ticket/31891 Commented Mar 7, 2013 at 21:42
  • What happens if you print sys.path()? Commented Mar 7, 2013 at 21:44

1 Answer 1

1

Looking at this issue on github, it sounds like it might require a specific version of numpy - they used 1.7.0b2.

Sign up to request clarification or add additional context in comments.

2 Comments

This issue is not related to scikit-learn at all as far as I can tell.
@AndreasMueller I think root cause might actually be related to this issue where the wrong library version is being given priority and installing a specific version just happened to fix that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.