vscode ipython interactive kernel slow startup and execution

13.2k Views Asked by At

On my work laptop (with a VPN connectoin), the python extension and interactive window/kernel are starting really slow, after restarting the kernel or VSCode a few times. The download speed of the internet connection is 250mbps and the upload speed 25mbps (that's not the problem).

Ipython kernel not starting

After I restart my laptop, everything runs fast (kernel is started in a few seconds). Restarting VSCode doesn't have the same effect.

starting put slow execution of code lines

I don't know were to look to find te problem.

Does anyone know what the problem might be? If you need more information, i'd like to provide it!

4

There are 4 best solutions below

1
On

Make sure your notebook is of small size. I had the same problem with a notebook that had many plots inside. Clearing these plots sped things up for me.

My guess is that whenever you make a change to a big notebook, vs code will upload a lot of things which then slows down execution.

5
On

When I reopened VS Code and immediately opened "Interactive", I also encountered the same problem, sometimes it could not be opened, sometimes it was very slow.

Reason: In VS Code, Since the "Interactive" function is provided by the extension "python", it needs to load the extension "python", then start this function and execute the code.

Solution:

It is recommended that you create or open a python file (.py file) after opening VS Code, wait for the extension and language service to load, and then open and use the "Interactive" function. In addition, in order to shorten the loading time, please disable VS Code extensions that you don't need to use and ensure a good network.

If all the required items are loaded but the "Interactive" window is still open and running slowly, please try to close other applications on the computer and reload or restart VSCode.

Github link: "Python extension loading" super slow.

0
On

Small (less than 10MiB) size case

  1. Open plain .py file in same VSCode window.
  2. Close all notebooks.
  3. Open your notebooks again.

Bigger size case

First of all, I suggest you to wait a bit - due to VSCode extensions render overhead, loading the notebook may took times more time than in your browser. If it doesn't help in adequate time:

  1. Open the notebook in browser.
  2. Clear all its outputs.
  3. Reload VSCode window (e.g. using Command Pallette: Ctrl+Shift+P->Reload Window)
0
On

Guided by https://github.com/microsoft/vscode-python/issues/14639


I suggest to do the following steps:

  1. CTRL + P
  2. Search for >Preferences: Open User Settings (JSON)
    - (settings.json)
  3. Add "python.experiments.optInto": ["pythonDiscoveryModule"]
  4. Save the file
  5. View > Comand Palette and running Developer: Reload Window

Another option to monitor performance:

  • help > toggle developer tools > performance tab > start recoding