Skip to content
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

Extract and Run Python is broken? #150

Closed
tradergt opened this issue Mar 10, 2024 · 2 comments
Closed

Extract and Run Python is broken? #150

tradergt opened this issue Mar 10, 2024 · 2 comments

Comments

@tradergt
Copy link

When I create an appimage using bazel and execute it, it works exactly as its supposed to. However, when I run it in a container, it wont work. That, of course, is where appimage-extract-and-run comes in.

When I run it via appimage-extract-and-run, it can not find the python3 executable.

/usr/bin/env: 'python3': No such file or directory

When I look, it seems to run AppRun which looks like:

export OLDPWD
export PWD="/tmp/bazel-working-directory/_main"
export SHLVL="1"
export TMPDIR="/tmp"
[ "${BUILD_WORKING_DIRECTORY+1}" ] || export BUILD_WORKING_DIRECTORY="$OWD"
workdir="$(dirname $0)/database/mysql/bin/change_instruments.runfiles/_main"
export RUNFILES_DIR="$(dirname "${workdir}")"
cd "${workdir}"
exec "./database/mysql/bin/change_instruments" "$@"

The problem with the above is it's pointing to python being in #!/usr/bin/python3. There is no python installed in the container. I do see the python install buried in the /tmp/appimage_extracted*. I think the apprun above is incorrect. It should point to the buried python3, right?

@lalten
Copy link
Owner

lalten commented Mar 10, 2024

This is due to bazel-contrib/rules_python#691 and unrelated to rules_appimage, which is entirely language agnostic (as far as the payload binary goes).

People have played around with the customizeable shebang line of the Python wrapper that Bazel generates as an entrypoint for you.
I hear that Aspect's rules_py doesn't require a bootstrap Python but I haven't used that myself yet.
(Or you could just install a host python inside your container)

@tradergt
Copy link
Author

I have switched to using aspect_rules_py. It fixes the above problem.
Thanks for your help as it pointed me in the right direction!

@lalten lalten closed this as completed Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants