Skip to content
Advertisement

VSCode not recognizing python import and functions

Can someone let me know what the squiggly lines represent in the image? The actual error the flags up when I hover my mouse over the squiggly line is:

Import “pyspark.sql.functions” could not be resolvedPylance

I’m not sure what that means, but I’m getting the error for almost all functions in VSCode.

Can someone let me know how to resolve it? enter image description here

enter image description here

enter image description here

enter image description here

Advertisement

Answer

I was with the same error as yours. VSCode usually has a “recommended” interpreter, but sometimes it won’t help you out with what you need. So,

  1. I changed the Interpeter (ctrl + shift + p in VSCODE).
  2. Look for “Python: Select Interpreter.
  3. Choose the one who contains the name “Conda”

And that’s how the magic happens.

5 People found this is helpful
Advertisement