"Undefined variable from import" when importing numpy in eclipse pydev "Undefined variable from import" when importing numpy in eclipse pydev numpy numpy

"Undefined variable from import" when importing numpy in eclipse pydev


The LD_LIBRARY_PATH has to contain paths to the MKL libraries. Even if LD_LIBRARY_PATH is set properly, it has to be explicitly specifed in Eclipse under Window > Preferences > Interpreter - Python, under the "Environment" tab on the right hand side. Add a new variable called "LD_LIBRARY_PATH" and paste the content of $LD_LIBRARY_PATH.

Once it is done, errors will only disappear from your code if a line is added to the code which uses a numpy object so that imports are checked again.


I managed to fix it by updating the Phyton interpreter in Eclipse. Just click on Apply button after successfully installed Numpy module.


Are MKL libraries and numpy the same thing? @user1898039's answer didn't make sense to me (I'm not sure what path I should use for that property.

I found another way to fix this issue - I checked the python command line to see if numpy was installed there by calling:

>>> import from numpy *

It was not. So, despite the fact that numpy was showing up in PyDev under the "Forced Builtins" tab in the Python Interpreter properties, it wasn't available to python from the command line and I imagine this caused the issue inside PyDev.

So, I fixed the problem by going to the numpy site and installing the newest version for windows. Technically I went to some other site that had a AMD64 version of the installer for windows, buy you know, same same. After that I tried to get the PYTHONPATH variable to recalculate all the libraries (this may have been unnecessary), but errors were still showing in the file on all the calls to array(). I did an autocomplete on the numpy package to get the list of functions, selected array() from that list, and all of the sudden all the errors cleared and everything is fine now.