Whenever I try importing numpy in my new installation of Eclipse and Pydev, I get the following error:
Traceback (most recent call last):
File "Q:\temp\test.py", line 1, in <module>
import numpy
File "C:\Python26\lib\site-packages\numpy\__init__.py", line 132, in <module>
import add_newdocs
File "C:\Python26\lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
from lib import add_newdoc
File "C:\Python26\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
from type_check import *
File "C:\Python26\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "C:\Python26\lib\site-packages\numpy\core\__init__.py", line 13, in <module>
import defchararray as char
File "C:\Python26\lib\site-packages\numpy\core\defchararray.py", line 23, in <module>
from numpy.core.multiarray import _vec_string
ImportError: cannot import name _vec_string
However, in a vanila python console and in IPython, import is successful
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
Q:\Groups\Bioinformatics\HPLCautomatization\autohplc>ipython
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [2]: import numpy
To make stuff even more complicated, in another Eclipse workspace, this import works fine. Restarting eclipse didn't help. I also tried to re-config the interpreter in Preferences->python->interpreter->python (as in this question), but the problem still exists
Two additional similar problems were described on SO (this and this), but both of them were observed with IronPython and I couldn't find anything I could use in the few answers that were provided.
EDIT As suggested by dutt, I checked Preferences->Pydev->Interpreter python->libraries in both the tested workspaces (the working one and the one that doesn't). The malfunctioning workspace contained the following library in system libs C:\Python26\lib\site-packages\numpy-1.5.0-py2.6-win32.egg . On the other hand, the working workspace doesn't list any numpy library in its system libraries list. I have removed the above library from the list in the not working workspace.