Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code not recognizing Python import and functions

What do 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 Visual Studio Code.

How can I resolve it?

Enter image description here

Enter image description here

Enter image description here

Enter image description here

like image 911
Patterson Avatar asked May 23 '26 14:05

Patterson


1 Answers

I was with the same error as yours. Visual Studio Code usually has a "recommended" interpreter, but sometimes it won't help you out with what you need. So,

  1. I changed the Interpreter (Ctrl + Shift + P in Visual Studio Code).
  2. Look for "Python: Select Interpreter.
  3. Choose the one who contains the name "Conda"

And that's how the magic happens.

like image 83
Amadeus Amorim Avatar answered May 26 '26 03:05

Amadeus Amorim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!