Open anki-code opened 3 years ago
Hello,
yes, I would expect this do work. Actually, I could distribute the relocated Pythons as zip files as well. AppImage is relevant only when running live without extracting. But for Python runtimes I find it more convenient to extract the images because then you can also pip install to the extracted image etc.
A starting point could be to use the relocate function on an OSX Python install. There might be some specificities related to OSX requiring extra tweaks though?
Do you have access to an OSX to test? If not this project can be very helpful: macos-virtualbox.
In a second step, if it works, you could use GitHub CI with an OSX worker and relocate its Python install(s)
Got it! Yep, I have OSX in VB for tests. Thank you for details and links! I'll dive into it.
Hey @anki-code . I was just curious if you had any success on this? I could make use of it as well for OSX :) But maybe this was not so straightforward? As they say: "the devil is in the details".
First of all I tried on Arch with Miniconda and had a success:
mkdir /tmp/reloc
cd /tmp/reloc
sudo python -m python_appimage build local
# No such file or directory: /usr/share/tcl8.6
vim /opt/miniconda3/lib/python3.8/site-packages/python_appimage/appimage/relocate.py
# Replace /usr/share to /usr/lib
sudo python -m python_appimage build local
# [2021-05-03 19:38:00,995] CLONE python3.8 from /opt/miniconda3
# [2021-05-03 19:38:12,748] PRUNE python3.8 packages
# [2021-05-03 19:38:12,749] SYMLINK python, python3 to python3.8
# [2021-05-03 19:38:12,749] SYMLINK pip, pip3 to pip3.8
# [2021-05-03 19:38:12,749] HOOK python3.8 site packages
# [2021-05-03 19:38:12,749] LINK python3.8 C-extensions
# [2021-05-03 19:38:14,705] INSTALL AppRun
# [2021-05-03 19:38:14,719] INSTALL python3.8.5.desktop
# [2021-05-03 19:38:14,720] INSTALL python.png
# [2021-05-03 19:38:14,720] INSTALL python3.8.5.appdata.xml
# [2021-05-03 19:38:14,721] BUILD AppDir
ls
# python3.8.5-x86_64.AppImage
Then I tried MacOS with Miniconda:
vim /Users/pc/miniconda3/lib/python3.8/site-packages/python_appimage/__init__.py
# Disable check
sudo python -m python_appimage build local
# [2021-05-03 09:42:16,608] CLONE python3.8 from /Users/pc/miniconda3
# [2021-05-03 09:42:30,737] PRUNE python3.8 packages
# [2021-05-03 09:42:30,745] SYMLINK python, python3 to python3.8
# [2021-05-03 09:42:30,747] HOOK python3.8 site packages
# [2021-05-03 09:42:30,750] LINK python3.8 C-extensions
# [2021-05-03 09:42:30,751] INSTALL patchelf from https://github.com/niess/patchelf.appimage/releases/download
# RuntimeError: /bin/sh: ./patchelf-x86_64.AppImage: cannot execute binary file
That's all for now :)
OK, I see. Patchelf needs a replacement on OSX. It is used to make binaries look for shared libs under a relative path (hence in the AppImage as well) instead of using an absolute one. So unfortunately more work is needed to make it relocatable on OSX.
I've found some builds of Python here - https://github.com/indygreg/python-build-standalone/releases/tag/20210415
Hey @anki-code . Interesting :) Does it work fine for xxh on OSX?
It looks like everything is built from scratch, isn'it?
Python-appimage instead relies on an existing install. It patches it in order to make it relocatable. In particular the manylinux installs are used, i.e. the same than for generating binary wheels which should ensure the same compatibility tags.
I tried to use libpython3.8.a
from python-build-standalone for xonsh-portable-binary (dockerfile) but without success. I got strange error about wrong format. That's all for now.
Hi! Thank you for your big work!
Is there a way to build Python on MacOS?
My idea is about to using unpacked AppImage with Python that can be run on MacOS. In this case I can build zip archive with the same structure as AppImage and use it on MacOS for xxh project.
What do you think?
Thanks!