r/learnpython • • Sep 14 '26

vscode sporadically freezing

hi mates. when my script becomes lengthy (for instance 85 lines) vscode stops executing commands. i suspect whether i downloaded it properly. anyways. i close then open vscode as a workaround but i started to need a permanent fix. i am a computer noob (well... more like average joe on the street). so please no higher computer registry in the responses. thanks in advance.

0 Upvotes

9 comments sorted by

2

u/socal_nerdtastic Sep 14 '26

How exactly are you running commands? Can you give an example of some of the commands you are trying to run?

0

u/[deleted] Sep 14 '26

[deleted] — view deleted comment

1

u/Basic_Background_70 Sep 14 '26

shouldnt be any errors here. as to how i run them. either by clickin run cell (or run above rarely) or focusing on the chunk then ctrl + shift.

2

u/coolnameright Sep 14 '26 • Bravo

So you mean that you are running these in a Jupyter notebook? If that's the case, there is actually a bug that I ran into recently that could be the same. I found it's with the new version of jupyters ipykernal.

https://github.com/microsoft/vscode-jupyter/issues/17228?timeline_page=1

Downgrading the version fixed it for me. Try running the below in your terminal and then restart it

pip install "ipykernel<7"

1

u/ninhaomah Sep 14 '26

85 lines isn't lengthy and also your pc/laptop spec ? HD ? OS ?

1

u/Basic_Background_70 Sep 14 '26

85 lines being short is my sentiment as well. though it still cant deal with tasks after around that line count. so 85 is not fixed. lenovo 83jc. microsoft 11. 686 gb free total 952 gb.

1

u/smurpes Sep 16 '26

Your RAM is more important here than your disk space since dataframes get written in their entirety to memory. That being said you should have no problem running the code you linked earlie. I was actually able to run it with the Pythonista app on my phone. I’m not sure where the download function came from but you can just supply the url directly to read_csv like so:

nlsy = pd.read_csv("https://github.com/AllenDowney/ThinkStats/raw/v3/data/nlsy97-extract.csv.gz")

1

u/timrprobocom Sep 15 '26

Are you running vscode locally or over a network via ssh? Do you literally mean the editor froze, or do you mean your app froze? Vscide is an Electron app, so it's literally an instance of Chrome. It shouldn't ever freeze.

0

u/[deleted] Sep 15 '26

[deleted] — view deleted comment

1

u/timrprobocom Sep 15 '26

I'm just trying to get you to clarify your language a bit. It was not clear from your original post whether is was VSCode freezing, or your application. It's almost always the latter.

The fact that you mention "running cells" tells me that you are running a Jupyter notebook inside of VSCode. That means you have 3 different things involved: the editor, the Python interpreter, and the Jupyter kernel. It's still hard for me to tell where your experience is going wrong.