Skip to content
Advertisement

Unable to use “from numpy import *”

I was trying to import numpy like the below format, but it was not working. It was throwing me some errors. The IDE was VS Code. I already installed NUMPY in pip on CMD. Still it is not working. This is the Screenshot of Error in VS code

Advertisement

Answer

These are more warnings than errors in your screenshot

You’re importing everything from the numpy namespace. These errors indicate that you aren’t using any of these classes yet. Pylint is telling you on each warning line of the Problems Tab, there is an “unused-wildcard-import” (That import is not being used in your code yet)

If you only need to import certain classes from numpy I would reccomend importing only what’s neccessary

For example:

from numpy import [required_import], [required_import2], ...etc.
#These packages can be separated out in commas as shown above

Try comment or omit this import statement out and only use imports where neccessary from numpy

Also good to verify you have numpy installed by

try:
    import numpy
except ImportError:
    print("Numpy not Installed")
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement