PyOxidizer
PyOxidizer copied to clipboard
Incompatibility with PIL ?
Hey, using python 3.7 on mac and running build using a venv with all the dependencies installed. The application runs fine using python and the venv but when I build with pyoxidizer and try opening it I get the following error:
Traceback (most recent call last):
File "app", line 4, in
Does anyone have any suggestions on what I can try?
Hi all,
I have a problem with Pillow but the output is different:
❯ ./build/x86_64-unknown-linux-gnu/debug/exe/gork
Traceback (most recent call last):
File "gork.main", line 3, in <module>
File "gork.image", line 10, in <module>
File "PIL.Image", line 93, in <module>
ImportError: /home/gokmen/Workspace/alageek/gork/build/x86_64-unknown-linux-gnu/debug/exe/lib/PIL/_imaging.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory
SystemError
The only dependency is Pillow, I use the latest version of PyOxidizer (0.7.0), and my OS is Ubuntu 19.04. Here you can see the source code of the project: https://github.com/gkmngrgn/gork
Is it a compatibility problem? Or just a wrong configuration? I would like to help you to solve this issue.
Just wanted to chime in and report that I'm getting the same error, ImportError: cannot import name '_imaging' from 'PIL' (unknown location)
, on the latest published version. (I tried to test with the latest code from main
but was unable to get it to compile correctly.)
I found a similiar issue on the pyinstaller page: https://github.com/pyinstaller/pyinstaller/issues/5366
It seems that pillow uses another folder for storing the library data in site-packages (Pillow.libs
). But pyoxidizer does not seem to package them with, even if I do some special treatment for pillow (namely force pyoxidizer to store Pillow into a libs directory), by doing something like in pyoxidizer.bzl
:
def make_exe(dist):
# Some stuff ...
# ...
policy.resources_location_fallback = "filesystem-relative:lib"
for resource in exe.pip_install(["pillow==8.1.0"]):
resource.add_location = "filesystem-relative:lib"
exe.add_python_resource(resource)
Then I don't get the import error, but the error mentioned in the pyinstaller issue.
If I copy the correct libs into lib/Pillow.libs
it seems to work, the problem is that it is not that easy to get the right libraries as the systems python and the pyoxidizer python maybe different and so there may other library versions be needed.
@indygreg I am encountering this at work actually because we have to ship Pillow. Do you have any recommendations? I'm not exactly sure how to perform the work around mentioned in the previous comment.
It's actually a different error message but I assume it's the same underlying issue https://github.com/indygreg/PyOxidizer/issues/676