-
-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reload slow, no response to ctrl-C on Windows #3652
Comments
Wow. That sounds serious. We aim for a super fast reload. Can anyone else with Windows reproduce this? |
@superlou do you test it in pure termial or in ide's integrated terminal? It soulds like similar bug in pycharm or in vscode i met. |
I was testing in a pure terminal, both Powershell and CMD had similar behavior (as well as Microsoft Terminal running Powershell). |
@superlou On Linux it's nearly instant for me so seems to be a very Windows-y problem. Upgrading to the latest NiceGUI version doesn't seem to change anything speed-wise either so it might be related to the way filewatcher picks up on filechanges on Windows in comparison to the other OS-es? |
@frankhuurman, I don't think it's filewatcher, only because when I save, it immediately pops up with the notification that a file changed. The issues happen in the delay after. Does nicegui use uvicorn logging? This comment describes my ctrl-c behavior. |
Interesting @superlou! Uvicorn logging can be disabled with |
Just got a chance to try it with logging disabled. No change unfortunately. Was really hoping it was something straightforward. from nicegui import ui
ui.button("Button 1")
ui.button("Button 2")
ui.button("Button 3")
ui.run(uvicorn_logging_level='critical') It's still 5 to 10 seconds to reload (if it does) when commenting and uncommenting buttons. I'm pretty sure it's reacting to |
Just noticed that you're using Python 3.12. Could you try your same code using Python 3.11 on Win 11? Back then it seemed to be an upstream problem that needed to be fixed but I assumed that would've been done by now, but I'm curious if downgrading your Python version solves the issue for now. |
I used uv to test with Python 3.11.9, and it's the same behavior. WatchFiles detects changes immediately, but it takes about 15 seconds to respond in the browser. |
I'm just starting out with NiceGUI on Win11 running Python 3.10 and have had similar issues. Same as @superlou I'll start the server, make a change in VSCODE and it sometimes will reload ok, but it's 50/50 between that or just locking up and needing me to kill Python in the task manger. Running it via Powershell in Microsoft Terminal if that helps. |
I'm seeing the same issue on Windows - reloads (and loads) are super slow and frustrating. Python 3.12.7 |
I'm not sure this is the root cause, but is there a way to try the solution suggested in encode/uvicorn#1972 (comment) to see if it's something related to filewatches in uvicorn? I'm not sure how to configure nicegui to test that. |
@superlou This works for me on Mac: watchfiles --filter python "python main.py" |
Unfortunately, when I edit the test file (same process as earlier by commenting/un-commenting buttons) on Windows, either the page doesn't update or I get a permissions error:
|
Description
A simple application starts up in a second or two, but on making a change, reloading may take 10 seconds or more and may hang. Additionally, when hung, the terminal (both PowerShell and CMD) has no response to ctrl-c or clicking the close button. It's been about a year since I've used NiceGUI on Windows (I mostly use Linux) and I don't remember this behavior before.
It sounds a bit like #3344, but this isn't in PyCharm. There are also some issues in uvicorn like encode/uvicorn#1972 that sound related, but I know enough about the NiceGUI stack to know if that could be the root cause.
My test script is:
Steps to recreate:
simple.py
.python simple.py
in a Windows terminal.ui.button(...)
calls and save the file.Environment:
Edit: I tried the same test in WSL2 on the same computer and reloads are very fast, under a second.
The text was updated successfully, but these errors were encountered: