[GH-ISSUE #67] Documentation Suggestion re: concurrent.futures #66

Closed
opened 2026-02-26 12:20:22 +03:00 by kerem · 5 comments
Owner

Originally created by @William-Lake on GitHub (Aug 16, 2019).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/67

Hi Brent,

First off- thanks again for this project! I've been using it a ton and I really appreciate you taking the time to put it together.

I'm opening this issue to share a minor hurdle I came across today which only came up after packaging my project. The issue has nothing to do with auto-py-to-exe as it turns out, but the fix was so easy that I'm hoping by posting the solution here it may help out someone else with a similar problem.


If the script(s) you're packaging use concurrent.futures for any multi-threading/processing then you'll want to add the following to your imports:

from multiprocessing import freeze_support

and this to your main:

freeze_support()

Before adding this I kept getting errors re: concurrent.futures when trying to run the packaged project, even when everything worked fine before packaging it. After some troubleshooting/Googling I came across this StackOverflow entry which led me to this bug report (see the second entry by Torsten Landschoff.)

After making the minor change, my project ran without issue as a one-file .exe.

This is a pretty specific use-case, so I'm uncertain if it would be helpful to add this to the documentation as a "pro-tip" (if at all considering the root cause wasn't auto-py-to-exe.) I figured I might as well bring it up either way- if you'd like me to add it somewhere and submit a pull request I'd be happy to do so.

Thanks Brent!

Originally created by @William-Lake on GitHub (Aug 16, 2019). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/67 Hi Brent, First off- thanks again for this project! I've been using it a *ton* and I really appreciate you taking the time to put it together. I'm opening this issue to share a minor hurdle I came across today which only came up after packaging my project. The issue has nothing to do with auto-py-to-exe as it turns out, but the fix was so easy that I'm hoping by posting the solution here it may help out someone else with a similar problem. ___ If the script(s) you're packaging use concurrent.futures for any multi-threading/processing then you'll want to add the following to your imports: ```python from multiprocessing import freeze_support ``` and this to your main: ```python freeze_support() ``` Before adding this I kept getting errors re: concurrent.futures when trying to run the packaged project, even when everything worked fine before packaging it. After some troubleshooting/Googling I came across [this StackOverflow entry](https://stackoverflow.com/questions/28631288/concurrent-futures-works-well-in-command-line-not-when-compiled-with-pyinstal) which led me to [this bug report](https://bugs.python.org/issue21505) (see the second entry by Torsten Landschoff.) After making the minor change, my project ran without issue as a one-file .exe. This is a pretty specific use-case, so I'm uncertain if it would be helpful to add this to the documentation as a "pro-tip" (if at all considering the root cause wasn't auto-py-to-exe.) I figured I might as well bring it up either way- if you'd like me to add it somewhere and submit a pull request I'd be happy to do so. Thanks Brent!
kerem closed this issue 2026-02-26 12:20:22 +03:00
Author
Owner

@brentvollebregt commented on GitHub (Aug 18, 2019):

Oh wow, that's something I have not come across before, thanks for pointing this out!

I think the best way to address this would be to add it to the help post I've been adding to which is linked at the bottom of the UI after every build. I know adding this to the user's script is an option but I am not too keen on directly manipulating a user's program as it could cause other side effects.

I'll close this issue when I get some time to add it; thank you very much!

<!-- gh-comment-id:522289820 --> @brentvollebregt commented on GitHub (Aug 18, 2019): Oh wow, that's something I have not come across before, thanks for pointing this out! I think the best way to address this would be to add it to the [help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) I've been adding to which is linked at the bottom of the UI after every build. I know adding this to the user's script is an option but I am not too keen on directly manipulating a user's program as it could cause other side effects. I'll close this issue when I get some time to add it; thank you very much!
Author
Owner

@brentvollebregt commented on GitHub (Sep 1, 2019):

I've just added a section to the help post. Sorry for the delay.

Thank you very much for reporting this, it's very helpful that this issue is available for others with similar issues.

<!-- gh-comment-id:526904277 --> @brentvollebregt commented on GitHub (Sep 1, 2019): I've just added [a section to the help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#using-concurrentfutures). Sorry for the delay. Thank you very much for reporting this, it's very helpful that this issue is available for others with similar issues.
Author
Owner

@William-Lake commented on GitHub (Sep 12, 2019):

Hey! Sorry for my (incredibly late) reply- I'm happy to help!

<!-- gh-comment-id:530959479 --> @William-Lake commented on GitHub (Sep 12, 2019): Hey! Sorry for my (incredibly late) reply- I'm happy to help!
Author
Owner

@nednoodlehead commented on GitHub (Aug 26, 2022):

Is there any fix for threading? I seem to have a similar issue where command prompt (windows) opens and closes immediately every time I create a thread

<!-- gh-comment-id:1228965483 --> @nednoodlehead commented on GitHub (Aug 26, 2022): Is there any fix for threading? I seem to have a similar issue where command prompt (windows) opens and closes immediately every time I create a thread
Author
Owner

@brentvollebregt commented on GitHub (Aug 26, 2022):

@nednoodlehead can you open a new issue with a minimum reproducible example? It sounds like your problem would be better in a new issue rather than this documentation one.

<!-- gh-comment-id:1229031354 --> @brentvollebregt commented on GitHub (Aug 26, 2022): @nednoodlehead can you open a new issue with a minimum reproducible example? It sounds like your problem would be better in a new issue rather than this documentation one.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#66
No description provided.