-
Notifications
You must be signed in to change notification settings - Fork 503
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
Fails to start with KeyError: WERKZEUG_SERVER_FD
#425
Comments
Try an older version of python library "werkzeug". Version 2.1.0 was faulty for me. Version 2.0.0 does work.
|
Same problem. |
Can this be fixed upstream by pinning the expected werkzeug version somehow? This is a pretty bad first-use impression! |
I think allways the latest version of Werkzeug is used. Werkzeug 2.1.0 is recently released: https://pypi.org/project/Werkzeug/#history |
I also met this issue, solved by reinstallation of werkzeug 2.0.0 |
gdbgui/gdbgui/server/server.py Line 93 in 799d340
This line is why it's failing. You're tricking Werkzeug into thinking it's running in the reloader, when it's not. This breaks the environment it expects to find when starting the server. Remove this line. It seems this might have been done to enable |
While I agree with you, expliciltly setting
Do you have an idea how to hide these prints in werkzeug 2.1.0? Because this will probably prevent many people from upgrading from werkzeug 2.0.0 |
You don't. That output is there for a reason, we want to very strongly make people aware that they are running a development server, and that it is not meant for production. The fact that setting an internal setup variable happened to suppress it was unintentional and never guaranteed to work. "Production" means "not developing the application itself", even if it's a local application. The development server is not particularly secure, stable, or efficient. One way is to use a production server, such as waitress, which you can also import and run from Python code. If you're really, really sure it's ok to run the development server and also don't want the output, then you can use |
Thanks for the answer. |
Installing werkzeug 2.0 hasn't actually solved the issue for me. |
I get the same error as the OP, and installing werkzeug 2.0 does not solve the issue for me. Not sure if this is relevant: I'm running everything from within anaconda, on Xubuntu 20.04. gdbgui with no customization did work for me about five days ago, but since that time I've reinstalled the OS and anaconda, pipx, and gdbgui, which seems consistent with something having changed in the last few days. |
Downgrading to 2.0.0 worked for me, on a newly installed Debian 11 system. |
Me too |
I reinstall werkzeug 2.0.0. It does fix this issue for me. |
You still having problems dude? |
Not sure about @scotter1995, but werkzeug 2.0.0 has still not solved the issue for me. I've tried a number of times. But I am using in what may be a somewhat unusual environment (from Anaconda3, on Xubuntu 20.04 LTS). So I'm currently setting up Ubuntu 20.4 LTS in a VM and will install on that directly, andd without Anaconda. Will report back... UPDATE: Nope, not working for me. Installed gdbgui in Ubuntu 20.04 LTS VM (no Anaconda mediation). Reverted werkzeug to 2.0.0. Still the same error: verbatim with the error listing from OP. Moving on to a different GUI debugger... |
FURTHER UPDATE: Decided to try one last thing. Following the suggestion made by @davidism I commented out line 93 in server.py. Now it works for me. [AND, LAST BUT NOT LEAST]: |
Hi everyone, sorry for all the hassle with this issue. Looks like something needs to be adjusted in gdbgui's dependencies. I'll try to get to this but unfortunately have been extremely busy and unable to carve out time. You may have luck with a prebuilt binary or a pex from the releases page. |
Hi everyone, I had the same issue with the werkzeug. I installed the gdbgui by following the instructions (Method 1) from here: https://www.gdbgui.com/installation/ and I was not able to start the tool due to the werkzeug, even with |
Challenge accepted. import flask.cli
flask.cli.show_server_banner = lambda *args: None No more annoying console text. Enjoy! Update with hilarious comment @davidism posted and deleted for some reason:
God I love the internet. 😂 |
As the maintainer of the framework dependencies in your software I'd say that puts David in a position to know a good deal about what's best for your users. It's unfortunate for them that you're not listening. |
I am the owner/maintainer of this project, not @mconigliaro or anyone else. I unfortunately have not had time to work on anything open source lately, though there are plenty of things I'd like to improve on here. |
Sorry this turned into a weird discussion in your tracker, that's not what I intended when I originally commented. I think you can actually solve this in a fairly straightforward way: remove the env var line, and add eventlet or gevent as a requirement. Flask-SocketIO's |
This is just one of the first things that came up when I searched for "WERKZEUG_SERVER_FD," so I thought I'd share my solution. Sorry if you don't like it. Have a good day everyone. 😁 |
same issue here, downgrade werkzeug to 2.0.0 worked |
In my case The same doesn't work for a |
Had the same error after installing using Solution
|
I ran into the same issues. @peterbone-bo's workaround worked for me: installing gdbgui and werkzeug version 2.0.0 using |
- previously, `os.environ['WERKZEUG_RUN_MAIN'] = 'true'` was used in server.py to suppress the warning by tricking it to run in the reloader, while it was not - remove this line to print the warning to highlight that it *is* a development server (users should know this) and to make the server run again - see cs01/gdbgui#425 for reference
- previously, `os.environ['WERKZEUG_RUN_MAIN'] = 'true'` was used in server.py to suppress the warning by tricking it to run in the reloader, while it was not - remove this line to print the warning to highlight that it *is* a development server (users should know this) and to make the server run again - see cs01/gdbgui#425 for reference
This helped me run AWS SAM SERVER on a docker container! Thank you! |
It looks like the werkzeug code can be changed itself. Not sure if this is smart, but the hint was here:
In serving.py, it's a conditional that looks like so: if not is_running_from_reloader():
s = prepare_socket(hostname, port)
fd = s.fileno()
os.environ["WERKZEUG_SERVER_FD"] = str(fd)
else:
fd = int(os.environ["WERKZEUG_SERVER_FD"]) Modifying the code so the not is_running_from_reloader() section always runs fixed my use case invoking --- serving.py.orig 2022-08-30 06:29:39.000000000 -0500
+++ serving.py 2022-08-30 16:53:56.760826087 -0500
@@ -1055,12 +1055,9 @@ def run_simple(
application = DebuggedApplication(application, evalex=use_evalex)
- if not is_running_from_reloader():
- s = prepare_socket(hostname, port)
- fd = s.fileno()
- os.environ["WERKZEUG_SERVER_FD"] = str(fd)
- else:
- fd = int(os.environ["WERKZEUG_SERVER_FD"])
+ s = prepare_socket(hostname, port)
+ fd = s.fileno()
+ os.environ["WERKZEUG_SERVER_FD"] = str(fd)
srv = make_server(
hostname, Not sure if this is a bug in werkzeug or a bug with the code invoking it. Either way, this change got me past the error. |
I'm unsubscribing from this issue, which is about gdbgui specifically and is fixed. This is not the place to report other libraries issues with using the Werkzeug development server properly, nor is it a good idea to make any of the patches suggested here. @cs01 I suggest you lock this issue to avoid further off topic discussion. |
Describe the bug
gdbgui does not start. It fails with
KeyError: WERKZEUG_SERVER_FD
.To Reproduce
pipx install gdbgui
gdbgui
I get this output:
The firefox browser pops up before this output shows up but only shows an empty page.
Expected behavior
Gbdgui starts up and does something.
Please complete the following information:
gdbgui -v
): 0.15.0.1gdb -v
): GNU gdb (GDB) 11.2pip freeze
):Additional context
I tried running this inside an systemd-nspawn container, which does cause trouble sometimes. But this does not look like the typical container issue.
The text was updated successfully, but these errors were encountered: