Can't run pyinstaller binaries

I have a Python project which builds a binary with pyinstaller.
Building works fine but I can’t run it afterwards.
The result is the following:

bash: ./todoist_interface: No such file or directory

With steam-run I then get the following output, which I could work with:

Traceback (most recent call last):
  File "todoist_interface/", line 1, in <module>
    import settings
ModuleNotFoundError: No module named 'settings'
[1046319] Failed to execute script __main__

hmmm, overriding phases … hmmm… when i’ve done that in other scenarios, it’s not been good for me.

Might be unrelated.

I don’t think I’m really overwriting them since I wrote the software in the first place :person_shrugging:

Looks like

Should be:
from . import settings

Otherwise import settings is just trying to find a or settings/ under a path in sys.path. I would assume that pyinstaller is setting the top-level of the project as the CWD before launching the python interpreter, so that should be located in sys.path; and by convention, the python interpreter add the CWD to sys.path.


Thanks for the tip, the script in general should work (at least it does on Ubuntu).
I’m actually more curios if I could run it without having to use steam-run.

Without knowing more about how its runtime behavior, I’m not sure.

You could try doing an autoPatchelfHook phase, and see if you can’t satisfy the top-level binary.

My concern is that it might be unpacking a bunch of stuff at runtime, and the binaries located inside won’t be nix compatible.

1 Like

I’ll give it a try.
You’re right it is a self extracting zip file which then contains the required code.
It’s the only way I know to make a binary from a Python script.
Wouldn’t mind to try a different way, if you know of one but maybe the autoPatch will already help.

I tried it but it still behaves the same, however I’m not sure that I’ve applied it correctly.

After switching the project to poetry2nix everything works now as expected.
No need to patch the binary.