5

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!

Sander De Weert
  • 51
  • 1
  • 1
  • 3

3 Answers3

0

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.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
  • 1
    Thanks! The problem is that the python extionsion is loading slower, the more I use VScode and restart VScode. Closing every other application on the computer, makes no difference. The same for force closing VScode. Only restarting the computer makes everything run smooth for a while. If the python extension is loading fast, the interactive window starts and runs fast. If the python extionsion is running slow, the interactive window loads and runs slow. I think it has something to do with some memory/cache, but I've got no idea what it could be. Do you have any idea? – Sander De Weert Feb 01 '21 at 11:19
  • @Sande -The time I tested to load the 'python' extension is about 6-8 seconds. After loading, it only takes about 2 seconds to open "Interactive". As described in my answer, the "Interactive" function is provided by the "Python" extension, and this extension also provides functions such as "Jupyter", "debug", "Testing", "flask", etc. Therefore, it needs some time, but this is only when we first opened VS Code. – Jill Cheng Feb 02 '21 at 01:23
  • @Sander -In addition, you could also follow the content of [this link](https://github.com/microsoft/vscode-python/issues/14639#issuecomment-754187021). The problem of slow loading of the "python" extension is being improved. – Jill Cheng Feb 02 '21 at 01:36
  • The Github post, might have something to do with my problem. I'm also connected with my companys VPN. I don't know if it explains why the python extension and kernel are loading/running fast (a few seconds), after I restarted my laptop and are starting/running slow after restarting the kernel or VSCode a few times. – Sander De Weert Feb 02 '21 at 07:15
  • Or, we could just say that VS Code is crap at rendering notebooks. – FaCoffee Jan 24 '23 at 09:36
0

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.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 09 '23 at 13:17
0

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)