Package exo as installable
implementation uses nuitka to compile python to C and create an executable.
For reference, since we talked on X. Here are the issues I encountered:
- link to
exo-logo.icnsis wrong - python3.11 is hardcoded
- get this error (not sure how to fix -- we do want static linking, not dynamic linking):
FATAL: Automatic detection of static libpython failed. Homebrew Python is unexpectedly broken. Disable with '--static-libpython=no' if you don't want to install it.
Still getting this error:
(.venv) $ python3 build/build_exo.py
Nuitka-Options: Used command line options: exo/main.py --company-name=exolabs --output-dir=dist --follow-imports --standalone --output-filename=exo
Nuitka-Options: --macos-app-name=exo --macos-app-mode=gui --macos-app-version=0.0.1 --product-name=exo --macos-create-app-bundle
Nuitka-Options: --macos-app-icon=docs/exo-logo.icns --include-distribution-meta=pygments --include-distribution-meta=mlx --include-module=mlx._reprlib_fix
Nuitka-Options: --include-module=mlx._os_warning --include-data-files=./.venv/lib/python3.12/site-packages/mlx/lib/mlx.metallib=mlx/lib/mlx.metallib
Nuitka-Options: --include-data-dir=exo/tinychat=tinychat --include-module=exo.inference.mlx.models.llama
Nuitka-Options: --include-module=exo.inference.mlx.models.deepseek_v2 --include-module=exo.inference.mlx.models.base
Nuitka-Options: --include-module=exo.inference.mlx.models.llava --include-module=exo.inference.mlx.models.qwen2
FATAL: Automatic detection of static libpython failed. Homebrew Python is unexpectedly broken. Disable with '--static-libpython=no' if you don't want to install it.
An error occurred: Command '['python3', '-m', 'nuitka', 'exo/main.py', '--company-name=exolabs', '--output-dir=dist', '--follow-imports', '--standalone', '--output-filename=exo', '--macos-app-name=exo', '--macos-app-mode=gui', '--macos-app-version=0.0.1', '--product-name=exo', '--macos-create-app-bundle', '--macos-app-icon=docs/exo-logo.icns', '--include-distribution-meta=pygments', '--include-distribution-meta=mlx', '--include-module=mlx._reprlib_fix', '--include-module=mlx._os_warning', '--include-data-files=./.venv/lib/python3.12/site-packages/mlx/lib/mlx.metallib=mlx/lib/mlx.metallib', '--include-data-dir=exo/tinychat=tinychat', '--include-module=exo.inference.mlx.models.llama', '--include-module=exo.inference.mlx.models.deepseek_v2', '--include-module=exo.inference.mlx.models.base', '--include-module=exo.inference.mlx.models.llava', '--include-module=exo.inference.mlx.models.qwen2']' returned non-zero exit status 1.
https://github.com/Nuitka/Nuitka/issues/1353
A few high-level comments on this:
-
re: windows, I agree there are issues with windows more generally, but you made some small, useful changes here in
main.pythat (at least on my windows machine) get the program to start up, even if inference doesn't work. I agree that it's out of scope to get this actually running inference on windows but i think it should still be building it regardless, so that you generate an EXE file, and exo starts running (even if the actual inference doesn't work). -
To that end, if I run command
exoon my windows machine against the code on your branch, it starts up. But when i click the executable that build_exo.py generates, it doesn't run. It took an unusually long time to compile on my machine, but it did eventually return an executable. But when i click to run it, it opens a terminal and then shuts down pretty much immediately. Were you able to get this working? -
The circleci process runs
build_exo.py, but what happens to the artifacts after that? Ideally, I think you'd want to generated artifacts generate github "releases" (perhaps zip them first though) -
When I'm testing this on my m-chip mac, where everything "just works" for exo more generally, it creates a .app file that i can just click to run. But it runs a background process, and once a user closes the tab in their browser, the app is still running. If I then click on it a second time, it's still running. I think that ideal behavior would be that it runs with a little icon showing it as a service (ideally, with a small menu when you click the service icon that allows you to quit it). If you click the .app file a second time, it would just detect that it's already running and shut down.
I'm happy to clarify on any of the above, and I also have windows + linux + mac to test things if you need (although no GPU, so the first two don't work very well without being on the torch PR).
A few high-level comments on this:
- re: windows, I agree there are issues with windows more generally, but you made some small, useful changes here in
main.pythat (at least on my windows machine) get the program to start up, even if inference doesn't work. I agree that it's out of scope to get this actually running inference on windows but i think it should still be building it regardless, so that you generate an EXE file, and exo starts running (even if the actual inference doesn't work).- To that end, if I run command
exoon my windows machine against the code on your branch, it starts up. But when i click the executable that build_exo.py generates, it doesn't run. It took an unusually long time to compile on my machine, but it did eventually return an executable. But when i click to run it, it opens a terminal and then shuts down pretty much immediately. Were you able to get this working?- The circleci process runs
build_exo.py, but what happens to the artifacts after that? Ideally, I think you'd want to generated artifacts generate github "releases" (perhaps zip them first though)- When I'm testing this on my m-chip mac, where everything "just works" for exo more generally, it creates a .app file that i can just click to run. But it runs a background process, and once a user closes the tab in their browser, the app is still running. If I then click on it a second time, it's still running. I think that ideal behavior would be that it runs with a little icon showing it as a service (ideally, with a small menu when you click the service icon that allows you to quit it). If you click the .app file a second time, it would just detect that it's already running and shut down.
I'm happy to clarify on any of the above, and I also have windows + linux + mac to test things if you need (although no GPU, so the first two don't work very well without being on the torch PR).
Agree with these points. We can drop Windows support, so no need to fix 1 and 2. 3 and 4 are required for this to be merged.
We would want to package exo as a single file. There is a --onefile option with Nuitka.
Also should we change --macos-app-mode=gui to --macos-app-mode=background?
@josh1593