This can be caused by many reasons, some of them are as follows.
-
Python executable path in vscode is incorrect
- Solution: Configure the path to the python executable in
settings.json
. Remember to restart vscode after.
- Solution: Configure the path to the python executable in
-
The module is located in a non-standard location
-
Solution: Configure
settings.json
to include this location for autocompletion to work. An example (for Linux) used to add a custom module for the workspace:{ "python.pythonPath": "/usr/bin/python", "python.autoComplete.extraPaths": [ "${workspaceFolder}/customModule" ] }
-
-
vscode was not launched from the active virtual environment
- Solution: The path to the modules is set when a virtual environment is activated. Launch vscode from a terminal with the correct virtual environment activated