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.
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:
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
First of all if you've installed virtualenv on your project run vscode from there. Then in your vscode settings, i mean settings.json, you can follow my configuration or trace in which one you have a problem. Most of time this problem stem from putting incorrect path in pythonPath setting
"If you find IntelliSense has stopped working, the language service may not be running. Try restarting VS Code and this should solve the issue."
From https://code.visualstudio.com/docs/editor/intellisense and helped to me
My settings were all in order, but still not auto-completing in-line.
I disabled the Kite extension & a couple of other ones that I didn't really need, & IntelliSense started auto-completing.
Not 100% sure, but I reckon it might have been my "Kite" extension settings that were getting in the way.
I was also facing this problem and it's really annoying. This is a major bug of VS code that happens with installing some of the npm packages. VS code IntelliSense crashes and stops working after a few moments you start the VScode due to unsuccessful loading of the modules of the new package.
If you've tried everything but still if it doesn't work, in my case installing the extension Visual Studio IntelliCode with the Python extension worked.
Installing Pylance addon caused Vscode Intellisense to stop.
On disabling Pylance and enabling the Default Microsoft Python extension along with Visual Studio IntelliCode(Microsoft) and reverting to the Jedi server(prompted by Vscode) ,restarted intellisense detection.
In my case there was a problem with the python language server after a vs code update. The download of the language server was stuck every time. See enter link description here What I had to do was to open settings and type "languge server ". Then there are a few options like css, html etc. ( whatever you might have installed )
Select Python and search for lanuge server. Also if it is mentioned that the default is pylance, I had to switch it to Pylance and restart the ide ( update the window )
What worked for me was to uninstall the Python extension & restart VS Code. IntelliSense
sprang to life! This may not make sense as I left the extension uninstalled. Your comments are welcome!
In my case, Pylance was stuck at Loading... since the workspace contained too many files (Large dataset and many log files). Upon inspecting the python language server logs:
Enumeration of workspace source files is taking longer than 10 seconds.
For me, what fixed it was reinstalling the default Python extension and setting the python language server in the seetings to Default.
Steps
Open the commands window by simultaneously pressing CTRL/CMD + Shift + P. Now search for install extensions.
Select Python and install it (uninstall first if already installed).
Python is the default Python extension in VSCode and it installs Pylance by default.
Open the commands window again and search this time for Settings. Select Prefernces: Open settings (JSON).
In the JSON file search (CTRL/CMD + F) for python.languageServer and set the value to Default or Pylance as the default is currently Pylance (mine was somehow set to None!).
Once you save the file, a prompt will ask you if you want to reload vscode for the changes to take effect, click Yes!
That's it, intelliSense should be working now using Pylance!
Just a warning - the original question was asked several years back. Much has changed in that time, including the old MPLS language server being removed, Pylance shipping (but Jedi being the default), and then since mid 2021, Pylance being the default. If you're having issues check the dates on responses before following the advice given; it may be obsolete. The OP's issue is almost certainly one with MPLS which is long gone. If you are having issues with Pylance, consider opening an issue at https://github.com/microsoft/pylance-release.
In my case, I was working with a conda virtual environment.
I closed up the vs code editor
Then, navigated to the root of my virtual environment and relaunched vs code from there code .
Then, in the .vscode folder under my project directory, I opened the settings file and entered the path to the desired python installation (in my case, C:\User\user\miniconda\python.exe
I use this settings to have full auto-completion support. It isn't obligatory to set "python.defaultInterpreterPath" because you can set it from the status bar. Although if the venv is located in the same place for every developer you can set it for example to "${workspaceFolder}/.venv/bin/python".
{
// Index installed third party libraries and user files for language features such as auto-import, add import, workspace symbols and etc.
"python.analysis.indexing": true,
// Offer auto-import completions.
"python.analysis.autoImportCompletions": true,
// Automatically add common search paths like 'src'.
"python.analysis.autoSearchPaths": true,
}