Closed Daniel-I-Am closed 2 weeks ago
from multiprocessing import Process, freeze_support
def f():
print("Hello from cx_Freeze")
if __name__ == "__main__":
freeze_support()
Process(target=f).start()
Potentially related broken case on macos without fastapi
@Daniel-I-Am I confirm the bug. I'll work on it. @ntindle Can you check if #2435 is more related to your use case?
I think you're right that the issue you linked is more related
@Daniel-I-Am I improved the hook for multiprocessing.
You can test the patch in the latest development build:
pip install --force --no-cache --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze
The provisional documentation: https://cx-freeze--2443.org.readthedocs.build/en/2443/faq.html#multiprocessing-support
The must create a hypercorn.py script with the additional freeze_support:
from hypercorn.__main__ import main
from multiprocessing import freeze_support
if __name__ == "__main__":
freeze_support()
sys.exit(main())
I installed the development build and it looks like the problem is fixed now. I see the warning about requiring multiprocessing.freeze_support()
to be called, but the application starts fine (as I'm running it in a linux environment).
I will have to check how to insert that call when using the Hypercorn package binary. But it seems Hypercorn is starting fine now. Thanks for the quick fix!
I see the warning about requiring
multiprocessing.freeze_support()
to be called, but the application starts fine (as I'm running it in a linux environment).
Added a way to hide the message, check the provisional documentation: https://cx-freeze--2443.org.readthedocs.build/en/2443/faq.html#multiprocessing-support
Release 7.1.1 is out! Documentation
Describe the bug When running a program built with cx_freeze starting version 7.1.0, it adds additional arguments, which hypercorn does not accept. These arguments seem to be related to multiprocessing integration.
This causes programs built with 7.1.0 or up, to no longer be functional.
A temporary workaround is to downgrade back to 7.0.0.
To Reproduce All that is required is to run a hypercorn/FastAPI server (or it seems anything that uses multiprocessing) built with cx_Freeze on version 7.0.0 or 7.1.0.post0 (and also 7.1.0 was affected).
I added a full example to a reproduction repository: https://github.com/Daniel-I-Am/cx_freeze-fastapi-repro
Expected behavior I would expect programs that can be built with 7.0.0 to also be able to be built with 7.1.0.
Desktop (please complete the following information):
python:3.12-alpine
on linux