9

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

4
  • 1
    Did you select the right Python interpreter? Commented Dec 15, 2021 at 11:12
  • some questions: - does your code actually run without import errors? - do you use virtualenv? - is vscode using the right python version? Do you use the right shebang? stackoverflow.com/questions/6908143/… Commented Dec 15, 2021 at 11:12
  • Klaus, Josh, I'm new to VSCode. Can you let me know how to determine the right Python interpreter? How to instsall right Python version? Commented Dec 15, 2021 at 11:41
  • 2
    In the blue bottom bar somewhere on the left is the selected Python interpreter. If you have multiple installations you can select the right one there. Of cause you have to install the dependencies of your project for that interpreter version / virtual environment. Commented Dec 15, 2021 at 12:12

2 Answers 2

8

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Also check the Workspaces. If you have two or many workspaces opened (many codebase folders), the editor will be hard pressed to associate the interpreter-linter with the code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.