Vscode autocompletion doesn’t work for Jupyter Notebook

I recently started using Jupyter Notebooks on vscode but i’ve notices that code autocompletion doesn’t work properly.

If i create a regular .py file everything works correctly as you can see. It shows function signature and docstring. In both core python language and extern modules.

correct autocompletion core

correct autocompletion extern

But if i try the same in a .ipynb file it completely ignores autocompletion for print()

incorrect autocompletion

And what confuses me too if that for example it shows me np.sum() docstring but it doesn’t show me any np.concatenate() information gamong any other np.functions or other modules

[autocomplete np.sum4

autocomplete np.concatenate

Just in case im using Vscode and an conda enviroment as my python interpreter. Here is my settings.json file:

{
"python.dataScience.jupyterServerURI": "local",
"python.pythonPath": "C:\Users\myUser\anaconda3\envs\myEnv\python.exe"
}

Answer

According to your description, the reason for this situation is that different language services provide different functions such as automatic completion and prompts.

For the “print()” and “np.concatenate()” you mentioned, it is recommended that you use the “Pylance” extension, which provides excellent language services and auto-complete functions.

Please add the following settings in settings.json:

"python.languageServer": "Pylance",

enter image description here

enter image description here

Update:

Starting from November 2020, the function of Jupyter notebook in VSCode is provided by the extension “Jupyter”, which uses the “IntelliSense” provided by the extension “Jupyter”. And in “VSCode-insider” Jupyter notebook has better “IntelliSense”:

enter image description here

Github link: Hover Documentation Pop up does not work after VSCode 1.52 update.