You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Slow edits and completions when editing Python code #210528
Yes, but consider I did not use Pylance. Would you like me to test with it? I just activated it and opened the log trace for python and just for indexing it finishes its memory.
changed the title [-]Pylance chewing up resources when running cells in Jupyter notebooks[/-][+]Resource usage of Pylance slowing Jupyter notebooks[/+]on Mar 14, 2024
How could Pylance be interfering with Jupyter execution? Unless the user only has a single core and not enough memory? That would be for the user to decide then to turn off Pylance or Jupyter.
With MD it takes a bit longer to run, the computer warms up a little bit and it was done with Pylance deactivated. What most people has been reporting is Python/Jupyter being slow and only a couple of us have actually found out that Pylance was using a lot of resources (see #206119 (comment), #206119 (comment) and microsoft/pylance-release#5614). So yet again, no idea which one is it.
I also tried to retrieve the logs from Pylance, although when just opening VSCode, the log files something around 30,000 lines and some of the final lines are the ones above. Below you can find the log file.
Rich Chiodo (@rchiodo) I assumed that the numbers were off, and based on the comments from ale-dg disabling Pylance improved things.
However there are other things that slow Jupyter as well, but Pylance was reported as being one of them, e.g. if CPU/Memory is used, then VS Code tends to slow down, which slows down Jupyter extensions & others.
Feel free to close this issue if there's nothing to be done here, we're already looking into other issues reported by the user.
Before closing the issue, I was about to comment that I just ran again the large notebook with markdowns and these extensions:
Extensions (4)
Extension
Author (truncated)
Version
python
ms-
2024.2.1
vscode-pylance
ms-
2024.3.1
jupyter
ms-
2024.2.0
jupyter-renderers
ms-
1.0.17
After getting to where I wanted it (around coding cell 152), when typing in a function (i.e. OrdinalEncoder(), or any other from a library), the mini-window that pop-ups with hints loads VERY slow compared with other the previous versions when I downgraded, and it begins to lag. Also, when just beginning to type in the first parenthesis, it kind of stops everything else for loading the window (it stops around 3-5s). Then if we are lucky, it doesn't crash or lags or anything.
The same happens for the "auto-complete" function (not sure what its name is... but is the one that loads below the code for choosing a previous function or variable or something else).
ale-dg Please can you confirm that disabling Pylance extension makes it faster.
I.e. the following issue no longer exists
e mini-window that pop-ups with hints loads VERY slow compared with other the previous versions when I
Yes, you will no longer get completions, thats a different matter, however if it is still NOT faster, then we know for a fact that Pylance is not causing any delays and we can close this issue;
Don Jayamanne (@DonJayamanne) it ran with the same speed, but the lag with typing just went away. Would it be worth it to close this issue as it is actually a bug with Pylance lagging VSCode?
Well... just for the record, when I turned on Pylance again, I tested restarting the kernel to see what happens and all VSCode got stuck for some seconds (couldn't even scroll) and then it began to lag. In one of the issues was reported as well (and sometimes it crashes).
I also tried it without Pylance and it didn't crash. It just took its time to start running the notebook again.
Best
P.S. Also the "Go To" button still doesn't work...
Sometimes I have seen this taking 300ms when working on notebooks, we use markdown parser to build outlines and that ends up parsing markdown which results in 300ms sometimes.
So, this is definitely happening in other places too, but not 100% of the time.
The issue does definitely repro for me (again not 100% of the time), please let me know if CPU profiles (however we have this from the user) will help and what else information you need.
These are long issues so forgive me if this isn't new information, but I'm pretty sure I have the same problem described here and I've noticed something that might help?
When I type code into a cell and then try to execute it, when I get this laggy behavior, I notice inlay error messages like this show up:
As I watch (not touching anything, just waiting for the cell to execute), it progressively changes, as if it's analyzing prefixes of the content in the cell, or as if I were typing each character into the cell one by one very slowly. Here's another one (it made progress while I was typing):
I also, in this notebook where I just reproduced it, had a perfectly fine experience when I started from an empty notebook, for about 13 cells worth of mixed code and markdown, then around the 14th cell something changed and it started doing the bad thing. It was very sudden, like I'd crossed a threshold or something, which surprised me because before I've only seen it sometimes, when opening notebooks I'd already authored (and this reminded me to try reading these issues again).
I'd be happy to share a reproducer (my notebook is just 339KB including some plots), gather diagnostics, etc. but it looks like you have many? If you want, just point me to a message with instructions for gathering the ones that would help right now, I see you've done that quite a lot already. :)
Thank you,
We have made a lot of performance improvements in vscode for editing and executing notebooks
Please can you install the latest vscode insiders and the latest pre-release version of Jupyter extension and test this out
let me know how it goes
If you still run into issues please share the cpu logs while you are experiencing these same issues
Instructions here #210528 (comment)
I came across to this issue regarding the slowness of jupiter notebooks. I'm experiencing performance issues (extremely slow) when I try to print the shape of a dataframe or to show the head of the dataframe. It only happens when using:
Activity
[-]Pylance chewing up resources when running cells in Jupyter notebooks[/-][+]Resource usage of Pylance slowing Jupyter notebooks[/+]rchiodo commentedon Mar 14, 2024
How could Pylance be interfering with Jupyter execution? Unless the user only has a single core and not enough memory? That would be for the user to decide then to turn off Pylance or Jupyter.
ale-dg commentedon Mar 14, 2024
Hi Rich Chiodo (@rchiodo)
I honestly don't know. Everything has been a mystery as it happens with a lot of users, especially with large notebooks and lot of markdowns.
These are my Mac specs:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
These are the Jupyter logs I have retrieved for Don Jayamanne (@DonJayamanne) disabling Pylance, with and without markdown cells.
1-Jupyter-no-MD.log
1-Jupyter-with-MD.log
With MD it takes a bit longer to run, the computer warms up a little bit and it was done with Pylance deactivated. What most people has been reporting is Python/Jupyter being slow and only a couple of us have actually found out that Pylance was using a lot of resources (see #206119 (comment), #206119 (comment) and microsoft/pylance-release#5614). So yet again, no idea which one is it.
I also tried to retrieve the logs from Pylance, although when just opening VSCode, the log files something around 30,000 lines and some of the final lines are the ones above. Below you can find the log file.
Pylance.log
Let me know if I can be of any help (although I only know Python for DS 😜)
Best
DonJayamanne commentedon Mar 14, 2024
Rich Chiodo (@rchiodo) I assumed that the numbers were off, and based on the comments from ale-dg disabling Pylance improved things.
However there are other things that slow Jupyter as well, but Pylance was reported as being one of them, e.g. if CPU/Memory is used, then VS Code tends to slow down, which slows down Jupyter extensions & others.
Feel free to close this issue if there's nothing to be done here, we're already looking into other issues reported by the user.
ale-dg commentedon Mar 14, 2024
Hi,
Before closing the issue, I was about to comment that I just ran again the large notebook with markdowns and these extensions:
Extensions (4)
After getting to where I wanted it (around coding cell 152), when typing in a function (i.e. OrdinalEncoder(), or any other from a library), the mini-window that pop-ups with hints loads VERY slow compared with other the previous versions when I downgraded, and it begins to lag. Also, when just beginning to type in the first parenthesis, it kind of stops everything else for loading the window (it stops around 3-5s). Then if we are lucky, it doesn't crash or lags or anything.
The same happens for the "auto-complete" function (not sure what its name is... but is the one that loads below the code for choosing a previous function or variable or something else).
Best
DonJayamanne commentedon Mar 14, 2024
ale-dg Please can you confirm that disabling Pylance extension makes it faster.
I.e. the following issue no longer exists
Yes, you will no longer get completions, thats a different matter, however if it is still NOT faster, then we know for a fact that Pylance is not causing any delays and we can close this issue;
[-]Resource usage of Pylance slowing Jupyter notebooks[/-][+]Possibly high Resource usage of Pylance[/+]ale-dg commentedon Mar 14, 2024
Don Jayamanne (@DonJayamanne) it ran with the same speed, but the lag with typing just went away. Would it be worth it to close this issue as it is actually a bug with Pylance lagging VSCode?
Best
DonJayamanne commentedon Mar 14, 2024
lets leave this issue open, basically completions is slow
[-]Possibly high Resource usage of Pylance[/-][+]Slow completions[/+]ale-dg commentedon Mar 14, 2024
Well... just for the record, when I turned on Pylance again, I tested restarting the kernel to see what happens and all VSCode got stuck for some seconds (couldn't even scroll) and then it began to lag. In one of the issues was reported as well (and sometimes it crashes).
I also tried it without Pylance and it didn't crash. It just took its time to start running the notebook again.
Best
P.S. Also the "Go To" button still doesn't work...
97 remaining items
[-]Slow completions when editing Python code[/-][+]Slow edits and completions when editing Python code[/+]ale-dg commentedon Apr 17, 2024
Alright then. Thanks for the help! Hope it also helps in solving the other issue regarding the speed of execution.
Best
DonJayamanne commentedon Apr 17, 2024
Please can you provide a sample csv file used in your notebook
ale-dg commentedon Apr 17, 2024
Sure, attached the file.
Best
palmerpenguins_extended.csv
heejaechang commentedon Apr 18, 2024
don't notebook vs regular hover/signaturehelp use different markdown renderer?
DonJayamanne commentedon Apr 18, 2024
From what I can tell they are the same,
mjbvz commentedon Apr 18, 2024
Yes the parameter hints widget is the same everywhere, it's only notebook output that uses a different markdown renderer
DonJayamanne commentedon Apr 18, 2024
Matt Bierner (@mjbvz)
Sometimes I have seen this taking 300ms when working on notebooks, we use markdown parser to build outlines and that ends up parsing markdown which results in 300ms sometimes.
So, this is definitely happening in other places too, but not 100% of the time.
The issue does definitely repro for me (again not 100% of the time), please let me know if CPU profiles (however we have this from the user) will help and what else information you need.
leifwalsh commentedon Apr 20, 2024
These are long issues so forgive me if this isn't new information, but I'm pretty sure I have the same problem described here and I've noticed something that might help?
When I type code into a cell and then try to execute it, when I get this laggy behavior, I notice inlay error messages like this show up:
As I watch (not touching anything, just waiting for the cell to execute), it progressively changes, as if it's analyzing prefixes of the content in the cell, or as if I were typing each character into the cell one by one very slowly. Here's another one (it made progress while I was typing):
I also, in this notebook where I just reproduced it, had a perfectly fine experience when I started from an empty notebook, for about 13 cells worth of mixed code and markdown, then around the 14th cell something changed and it started doing the bad thing. It was very sudden, like I'd crossed a threshold or something, which surprised me because before I've only seen it sometimes, when opening notebooks I'd already authored (and this reminded me to try reading these issues again).
I'd be happy to share a reproducer (my notebook is just 339KB including some plots), gather diagnostics, etc. but it looks like you have many? If you want, just point me to a message with instructions for gathering the ones that would help right now, I see you've done that quite a lot already. :)
DonJayamanne commentedon Apr 20, 2024
Thank you,
We have made a lot of performance improvements in vscode for editing and executing notebooks
Please can you install the latest vscode insiders and the latest pre-release version of Jupyter extension and test this out
let me know how it goes
If you still run into issues please share the cpu logs while you are experiencing these same issues
Instructions here #210528 (comment)
carlos-andrade8 commentedon Oct 27, 2024
Hi Guys,
I came across to this issue regarding the slowness of jupiter notebooks. I'm experiencing performance issues (extremely slow) when I try to print the shape of a dataframe or to show the head of the dataframe. It only happens when using:
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
pd.set_option('display. width', 1000)
It tries to render but it takes so long. I'm not sure if the above is related to this issue.
Thanks,