Dear list members,
I would like to use PyOxidizer to distrubute a runtime environment for running our pure Python app. This is my first attempt to use PyOxidizer, so please appologise my possibly naive assumptions.
We need to distribute the app for Windows, Linux and Mac. Currently we are using AppImages on Linux and PEX on Mac. Unfortunately AppImages are Linux specific and PEX depends on system Python. We would like to try PyOxidizer to get one solution which includes the complete runtime including Python and all Python libraries. The best solution for us would be to have a single relocatable executable which would work as a Python interpreter including a complete virtual environment. This interpreter would run our Python code which we are fine to distribute separately. Is this what PyOxidizer can do?
Our possibly most problematic dependency is wxPython. Is PyOxidizer known to work with wxPython? Would it also work on M1 Macs? We are currently using Conda Miniforge packages for Mac because the M1 binaries are not available from pip.
When I attempted to add wxPython to the default pyoxidizer.bzl:
exe.add_python_resources(exe.pip_install(["wxPython==4.1.1"]))
I get the following error when running "pyoxidizer run":
error[PYOXIDIZER_PYTHON_EXECUTABLE]: adding PythonExtensionModule<name=PIL._imaging>
Caused by: extension module PIL._imaging cannot be loaded from memory but memory loading required
--> ./pyoxidizer.bzl:256:5
256 | exe.add_python_resources(exe.pip_install(["wxPython==4.1.1"]))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add_python_resources()
error: adding PythonExtensionModule<name=PIL._imaging>
Caused by: extension module PIL._imaging cannot be loaded from memory but memory loading required
So I tried to setup PIL resources to be loaded from filesystem:
policy.resources_location_fallback = "filesystem-relative:lib"
for resource in exe.pip_install(["Pillow==9.1.0"]):
resource.add_location = "filesystem-relative:lib"
exe.add_python_resource(resource)
But now I am getting this error:
Installing collected packages: Pillow
Successfully installed Pillow-9.1.0
error[PYOXIDIZER_PYTHON_EXECUTABLE]: adding PythonModuleSource<name=PIL.BdfFontFile>
Caused by: resource collector does not allow resources in filesystem-relative
--> ./pyoxidizer.bzl:254:9
254 | exe.add_python_resource(resource)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add_python_resource
error: adding PythonModuleSource<name=PIL.BdfFontFile>
Caused by: resource collector does not allow resources in filesystem-relative
Is there any known use case of PyOxidizer packaging PIL and wxPythpon? Any help would be much appreciated. Thank you for any comments or recommendations.
Best regards
Tomas Cerha