Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running tests of scipy and numpy on OS X Snow Leopard

I am new to stackoverflow as well as Python, and I hope to use stackoverflow to learn and improve my Python programming.

However, as soon as I set up Python, SciPy, NumPy on my Mac, I encountered a problem when I tried running a full test of SciPy and NumPy to verify the install:

>>> import scipy
>>> scipy.test()
Running unit tests for scipy

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    scipy.test()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/nosetester.py", line 318, in test
    self._show_system_info()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/nosetester.py", line 187, in _show_system_info
    nose = import_nose()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/nosetester.py", line 69, in import_nose
    raise ImportError(msg)
ImportError: Need nose >= 0.10.0 for tests - see http://somethingaboutorange.com/mrl/projects/nose

As suggested by the error message, I install this 'nose' package via easy_install, and the install seems successful as I get the following from bash:

mlstr:~ mlstr$ nosetests -V
nosetests version 1.1.2

So I tried the SciPy test again, and it failed with the same message. Can someone please let me know if I need to do anything else to install/configure nose so that it can be used by the unit tests of SciPy and NumPy. Thanks in advance.

UPDATE #1: After trying Rahul's suggestion of using pip to reinstall nose, I think I've found where the problem is: whenever I do easy_install or pip from bash, the package is installed into Python 2.6 directories instead of 2.7 ones. And I think this is because by default 2.6 is the one shipped with Snow Leopard. So what should I do to tell easy_install or pip that I want to install a particular package for Python 2.7? Thanks.

UPDATE #2: By following up my update above, I've found the solution here: easy_install with various versions of python installed, mac osx. It is indeed because that I used the wrong version of easy_install thus my nose installation was for Python 2.6 shipped with Mac OS X. Thanks.

like image 571
MLister Avatar asked Nov 08 '11 22:11

MLister


1 Answers

I tried replicating the error that you were encountering. I did not have nose, so I was getting the same error.

I installed nose using pip

sudo pip install nose

After that the scipy.test() worked. I did nothing else. Did you install nose using pip? If not, try using pip.

My machine has :
SciPy version 0.10.0.dev
Nose - 1.1.2

like image 172
Rahul Arora Avatar answered Oct 15 '22 21:10

Rahul Arora