When I run any program in the VS Code terminal, the program takes about 20-30 seconds before it starts running. After it starts, it runs at relatively normal speeds.
This is new behavior: code I was running last school year had much faster startup times. I am using no new extensions I am aware of that would be slowing this down- I have tried disabling extensions I don't need, but to no avail. None of the listed startup times appear to be the problem (Python extension's time is 282 ms, and that's the longest listed startup time).
I've tried uninstalling and reinstalling VS Code, and also tried installing Python 3.10.0 (I am using 3.9.0 by default).
Here is a sample of code that shouldn't take much time to start up, but does:
var = 1
while True:
print(var)
var += 1
This slow-start behavior is the same across all Python programs I've been running, infinite loop or no.
VS Code info:
Version: 1.61.2 (user setup)
Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643
Date: 2021-10-19T14:57:20.575Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043
FYI, I am a programming teacher, with no educational background in programming. I promise I'll do my best to answer your questions, but I may need some handholding to get there. Thank you for any help.
Edit: I've been in the habit of killing the terminal when I make changes to a program, then saving my program, then running it. I kill the terminal a lot. It turns out that if I only save and rerun my program (without killing the terminal), the first run starts slow, but then subsequent runs start just fine. This leads me to believe that the problem isn't with the program itself, but with my terminal starting slowly.
Going from your comments, I'm pretty sure the problem is not python or VS Code in your system, but PowerShell taking a much longer time to start.
I would advise you to switch to CMD, which takes much less time to start. Go to setting.json and add the line
"terminal.integrated.defaultProfile.windows": "Command Prompt"
Alternatively, you can click the + button in the integrated terminal, select Default Profile and select Command Prompt when the prompt appears on the top of the screen, as shown in the documentation of VS Code
If you want to fix PowerShell being slow itself, there are a lot of answers available online. You seem to be using an older version of PowerShell. You can update it to PowerShell Core 6, but I don't think it would be necessary. Changing the default profile to CMD should be enough to solve your issue.
Related
I am a Windows 10 user, and had configured the Python 3.10 IDLE to dark mode and had added the Fira Code font to the IDLE a few days back (Through the Options menu). Then the Python IDLE was working fine; without issues.
However, each time after that when I try to go to 'Configure IDLE' from Options Menu, Python IDLE just freezes and then stops responding, until I manually close it. It then asks to run a Windows check and reports the error to Windows. I have tried uninstalling and reinstalling Python; however that did not work.
Image: Python has stopped responding (happens everytime I click on configure IDLE)
I am a Windows user and tried running python from cmd using the command: py -m idlelib to start IDLE from the command line to try and get an error report, however the same problem happens as mentioned above, and I do not get an error report when I close Python. I tried finding solutions in similar questions, however I did not understand what was going on. I also do not seem to figure out how 'running the Python IDLE' through the command line works, other than running it using the above command. Can someone please assist me on what to do next at this point, that would be of huge help :D
Try uninstalling the font. The Doesn't work part of the Editor compatibility list on https://github.com/tonsky/FiraCode includes IDLE. I suspect that the font is incompatible with tcl/tk. Your report is similar to
IDLE Settings window won't appear
See https://bugs.python.org/issue45103 for so far futile efforts to protect IDLE.
UPDATE: We were not able to reproduce the problem with FireCode. However, the BPO issue referenced above lead to a tcl/tk bug report that lead to a bugfix, at least for the Phaistos font, that is included in tcl/tk 8.6.12. This is included in the new Python 3.9.9 Windows installer and will be in the upcoming 3.10.1 installer. It might fix your issue with FiraCode.
I recently started using Python. I realized that even the simplest program starts a Python process that never ends and causes my computer to overheat if I don't manually kill that process.
I've even seen multiple Python processes running at the same time after running a few easy Python programs (Hello, World!) in a row.
I updated to the latest Python version (Python 3.9.3), installed all the Certificates, and tested a few different programs to see if it happens every time—it does. I am using VSC as the IDE but the same situation happens even if I use IDLE.
My questions are: Is this an interpreter issue or a Mac issue? Can it be fixed?
Thank you very much.
I need to instrument a Python script using Intel Pin for ChampSim simulator.
The problem is, whenever I run the tool, the script does not seem to run as nothing is printed. Moreover, no matter how long/complex the script is, the trace always ends up with a size of 62M (this is also the case when I simply instrument the interpreter without any script).
I tried running the solution from this post, but it didn't work either. For reference, I am running the following command:
../../../pin -t obj-intel64/champsim_tracer.so -- ./python_script.py
Is it even possible to instrument a Python script? If yes, please detail the steps. Thanks!
I am using Anaconda/Iphython 32bit on a Windows machine wit Python version 2.7. Every time I run a script (different Modules are called) and it fails, I need to close the program and open it again if I want to change the code. If I change the code without closing/opening IPython, my changes in the code are not “updated”.
I tired %reset, but it does not work. I tried ‘Ctrl’, ‘Ctrl+’. and ‘Crtl-‘ without success (nothing happen).
It is really annoying because I have to change the Conda environment everytime and restart IPython :).
Any tips? Would be great
I am trying to stop execution of Python scripts in IPython in Windows. I have installed Python and IPython using Anaconda. However, whenever I press Ctrl+C, it breaks out of the current Python script as well as IPython. I saw a similar post here, which said to instead launch IPython with python C:\python27\scripts\ipython-script.py (or wherever that .py script is located), but for Anaconda users that script is in C:\Users\andre\Anaconda3\pkgs\ipython-5.1.0-py35_0\Scripts\ipython-script.py (which then changes with every version number if IPython that is installed). This ends up working but is certainly not convenient. I can make a quick shortcut/keybinding that runs that ipython-script.py script, but if and when I update IPython, I'm going to have to change the shortcut, and that seems rather inconvenient.
Any suggestions? I suppose I could add C:\Users\andre\Anaconda3\pkgs to my path, but that seems a little bit of overkill since there are a ton of packages in there.