ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
349 stars 35 forks source link

ImportError: dlopen - fpdf2 package #407

Open ProgrammingRobin opened 2 years ago

ProgrammingRobin commented 2 years ago

I'm trying to convert a python file by Py2app to a Mac OS app.

In this file I'm using fpdf2 to write in different pdf's, but looks like I have some problems with this package and the use of py2app. Thats why I just tested in again with just a really simple program, which is using fpdf2:

test = "test"
from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.set_font('times', size=20)
pdf.cell(0, 12, txt="Test", ln=True, align='L')
pdf.output('test.pdf') 

With following setup.py file:

from setuptools import setup

APP = ['test for compile.py']
OPTIONS = {
    'argv_emulation': True,
}

setup(
    app=APP,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

But when I want to execute the new standalone app I'm getting following error Message:

Traceback (most recent call last):
  File "-/test_for_compile/dist/test for compile.app/Contents/Resources/__boot__.py", line 463, in <module>
    _run()
  File "-/test_for_compile/dist/test for compile.app/Contents/Resources/__boot__.py", line 457, in _run
    exec(compile(source, script, "exec"), globals(), globals())
  File "-/test_for_compile/test for compile.py", line 2, in <module>
    from fpdf import FPDF
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fpdf/__init__.py", line 4, in <module>
    from .fpdf import (
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fpdf/fpdf.py", line 37, in <module>
    from PIL import Image
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 89, in <module>
    from . import _imaging as core
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_jpeg_resync_to_restart'
2022-02-21 14:53:48.261 test for compile[6126:387824] Launch error
2022-02-21 14:53:48.261 test for compile[6126:387824] Launch error
See the py2app website for debugging launch issues

I Posted the same on stack overflow, and there somebody recommend me posting this in issues here on Github.

So I would be really happy for some help :)

ronaldoussoren commented 2 years ago

FWIW: I cannot reproduce this issue on my end

I'm using:

Which version of Python do you use? How were PIL and fpdf2 installed?