-
Notifications
You must be signed in to change notification settings - Fork 71
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
How to execute single file packaged python binaries #45
Comments
Hi @drunksaint, Let me try this out first, and will get back to you in a couple hours. Best, |
@sadjad let me know if i can help with anything |
Okay, I managed to reproduce the error with a simple script, and I'm getting the exact same message. The problemThe PyInstaller bootstrapping function, tries to open and read the binary itself. From the looks of it, it takes That's the error message you're getting: I can think of a few solutions: Solution 1You can instruct
Two links are created: one a link to Solution 2Of course, doing all that is not the most convenient way to create thunks. You can also change Solution 3Take a look at Nuitka, it's a Python compiler that's faster and makes smaller binaries than PyInstaller. I tried it with my simple script, and it works out of the box with Please let me know if any of these helps! Best, |
Thanks for your help looking at this @sadjad. Both solution 1 and 3 worked for positional arguments! Solution 2 may not be required yet. I'll go down this road if I need to later. I had tried cython earlier but this was causing problems compiling larger libraries. That's why I started looking at pyinstaller. Nuitka seems to work great for larger libraries as well though. Thanks for this suggestion! I expanded the test python file argtest.py to use a more complex combination of positional and optional arguments and this caused failure using both solution 1 & 3. In solution 1, gg was trying to read the optional arguments itself ( the command i used (i.txt and j.txt are input files whose number of lines are read):
my wrapper file:
|
Hello there, Glad it worked!
I think the only thing that it's missing the
Yes, it does, but you need to tell it explicitly where the gg create-thunk \
--value $(gg hash input.txt) \
...
--output output.txt \
-- $(gg hash binary) argtest input.txt output.txt --any-option-you-like test
Sadly no. There are a few examples in here, and frankly, that's really all that's supported by |
I tried adding
The error I get:
I can add a PR for simple documentation to use a custom binary with gg (create wrapper file, python to binary) if that helps. |
The issue was that we didn't have support for non-file positional arguments (the first
That would be amazing. Thank you! |
Nice! now the thunk creation goes through. But
the python file if it helps. I created the binary using
|
Could you please run |
|
It looks like there's a bug in |
I just pushed a commit that hopefully fixes the issue! When I was looking at Please let me know if this fixes your problem. Thank you! |
@sadjad that would really help using gg with custom commands! :). Your changes + replacing I tried 2 other things:
associated wrapper file:
model inference error:
The error message seems to be related to your latest commit, so i thought it might be relevant. I really appreciate your help with everything here. Thanks! UPDATE: just realized that the shell is removing everything from the redirection operator. not sure what the best way to do this is. |
Awesome!
You should not include boolean flags in the description---only options with a required argument are necessary.
The redirection operator is handled by the shell itself and is never passed to the program. So, in case of However, there's a trick you can play. You can wrap the command you wanna run in another script. For example: #!/bin/sh
helloworld >o.txt Then, create a thunk for this script, which writes its output to A year ago, I was trying to make gg work for simple command line programs like |
Nice, this works! I've added this with our whole discussion to the documentation in this pull request
Sounds good. I'll try this.
This is neat! much better than having to write wrapper commands for all scripts. I tried running it but wasn't sure how to add iowrap as a thunk. I added the files from
|
Thank you for the pull request! I just had a peek and it looks great. Will merge it as soon as possible.
You're almost there! You need to The nice part is that you can pipe these commands together. For example, you can run:
And it will work. (as far as I remember!) (Unfortunately, |
Nice, it works with this fix! Piping works too! Thanks! But I'm not sure I'll be able to use it since the modeled I'm trying to parallelize a simple script. To do this, I'm splitting a file into small pieces and trying to create an output for each piece in an output directory. Outputs to the current directory work fine, but outputs to a subdirectory give an error:
Seems like the issue is that the directory |
You're right about this. Currently the system doesn't create the output directory automatically. Although, I think you can try creating the |
This should be possible, because at the time of thunk generation, I think we know how many files we have. But I'm not sure if current implementation of iowrap has support for multiple inputs. |
Ah i see, the I think I have a much better understanding of how gg can be used to parallelize a custom workload now. Thanks for your help with everything here! I'll close this issue. |
I have a custom python file argtest.py.txt that counts the number of lines from an input file and writes it to an output file:
I am trying to run this using gg. I tried packaging it to a single binary using pyinstaller (
pip install pyinstaller
)This creates a single binary argtest which gives the expected output.
But after adding the correct wrapper
and correctly generating the thunk in output.txt
running
gg force output.txt
results in the following error:the binary is of type:
is there something i am doing wrong here? any help will be appreciated!
The text was updated successfully, but these errors were encountered: