How do I get Pylint to recognize NumPy members? How do I get Pylint to recognize NumPy members? python python

How do I get Pylint to recognize NumPy members?


If using Visual Studio Code with Don Jayamanne's excellent Python extension, add a user setting to whitelist NumPy:

{    // Whitelist NumPy to remove lint errors    "python.linting.pylintArgs": [        "--extension-pkg-whitelist=numpy"    ]}


I had the same issue here, even with the latest versions of all related packages (astroid 1.3.2, logilab_common 0.63.2, pylon 1.4.0).

The following solution worked like a charm: I added numpy to the list of ignored modules by modifying my pylintrc file, in the [TYPECHECK] section:

[TYPECHECK]ignored-modules = numpy

Depending on the error, you might also need to add the following line (still in the [TYPECHECK] section):

ignored-classes = numpy


I was getting the same error for a small NumPy project I was working on and decided that ignoring the NumPy modules would do just fine. I created a .pylintrc file with:

$ pylint --generate-rcfile > ~/.pylintrc

And following paduwan's and j_houg's advice I modified the following sectors:

[MASTER]# A comma-separated list of package or module names from where C extensions may# be loaded. Extensions are loading into the active Python interpreter and may# run arbitrary codeextension-pkg-whitelist=numpy

and

[TYPECHECK]# List of module names for which member attributes should not be checked# (useful for modules/projects where namespaces are manipulated during runtime# and thus existing member attributes cannot be deduced by static analysis. It# supports qualified module names, as well as Unix pattern matching.ignored-modules=numpy# List of classes names for which member attributes should not be checked# (useful for classes with attributes dynamically set). This supports can work# with qualified names.ignored-classes=numpy

and it "fixed" my issue.