Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numpy build fails with cannot import multiarray

I'm using homebrew python on Mavericks, trying to build numpy 1.8. Unfortunately, when I try to install numpy, I get the following error: https://gist.github.com/ngoldbaum/8592039

I'm able to build numpy 1.7.2 with pip install numpy==1.7.2, but numpy 1.8 always fails to build with the same traceback.

like image 674
ngoldbaum Avatar asked Jan 24 '14 04:01

ngoldbaum


People also ask

How do I fix NumPy core Multiarray failed to import?

The problem is that you might have created a file called numpy.py. This file might coincide with numpy library. So, delete that numpy.py file and the problem gets solved.

Can not import NumPy?

Python import numpy is not working that means eithers the module is not installed or the module is corrupted. To fix the corrupted module, uninstall it first then reinstall it.


2 Answers

on Mac:

1.) remove these 2 folders manually:

rm -rf /usr/local/lib/python2.7/site-packages/numpy/
rm -rf /usr/local/lib/python2.7/site-packages/numpy-1.10.4.dist-info/

notice: pip uninstall numpy didn't work for me, I had to remove numpy manually.

2.) re-install numpy: pip install numpy

like image 50
Brian Avatar answered Oct 24 '22 19:10

Brian


This was solved by doing brew uninstall python, deleting the contents of /usr/local/lib/python2.7/site-packages, reinstalling python, and then rebuilding numpy.

like image 37
ngoldbaum Avatar answered Oct 24 '22 18:10

ngoldbaum