PyDev - Eclipse can import numpy, but none of them work?

I have a problem importing a numpy module in Eclipse. The string import numpyworks without problems. But if I try to use a function from the numpy module (e.g. numpy.zeros, numpy.uint8, etc.), I get an error Undefined variable from import.

Functions work fine in a python interpreter or actually run a python script. The problem is that Eclipse recognizes module functions. I had no problems adding other such modules. All the modules I use are fromunofficial windows binaries. Once I installed them, I simply added the module directory to the Eclipse interpreter libraries to make them work. This was unsuccessful for numpy. I even tried adding each of the numpy package subfolders to the interpreter libraries. I checked the import in the interpreter using Python multi-page startup to find out that everything happens during the import, but I don’t see much that I have not tried to add to the Eclipse interpreter libraries yet. I tried using earlier versions of numpy and the version from the official numpy site, but with the same result. I also tried adding the numpy directory to the PYTHONPATH project, but without success either.

I use Windows 7, Python 2.7 and 64 bit versions of all packages (and python).

Any suggestions? Thank you very much!

+4
source share
1 answer

My bet is that since it is numpy.__init__conditionally loaded on importwith the help of a block if __NUMPY_SETUP__, the static analyzer has no idea which branch will work, and thus simply cannot determine what will be in the module namespace. You should try adding NumPy to forced built-in functions in PyDev. I had similar problems with other libraries (e.g. nothing with flask.ext), but basically they just learned to ignore them.

+1
source

All Articles