Today I was running my python script in my jupyter notebook in vscode. At some point the program crashed. Afterwards I was not able to run the notebook at all since I always get this error: Failed to start the Kernel. Unable to start Kernel ... due to a timeout waiting for the ports to get used.
I already reinstalled jupyter, notebook and vscode. But I have no idea what I can do now.
Restart Everything
Close VS Code completely
Kill all Jupyter/Python processes in Task Manager
Restart your computer
2. Reset Jupyter Configuration
Delete Jupyter config files (found in ~/• jupyter and ~/. ipython folders)
Let VS Code recreate fresh configs on next launch
3. Change Default Port
Modify VS Code settings to use a different port (like 8889 instead of 8888)
Check for port conflicts with other applications
4. Reinstall Dependencies
Update Jupyter, ipykernel, and notebook packages
Reinstall the Python kernel
5. Check System Permissions
Temporarily disable firewall/antivirus
Ensure VS Code has proper network access
Prevention Tip:
Always properly shutdown kernels using the VS Code interface before closing notebooks.
If still not working:
Try creating a new Python environment
Test with a different Python version
Check VS Code/Jupyter extension updates