3

A similar question was asked before by someone else: https://stackoverflow.com/questions/23600028/py2app-app-crashes-on-earlier-mac-os-x-versions

I have an app that runs fine on my machine (OSX 10.9.4), but when I move it to another machine running 10.7.5, the app crashes on start up. I get the following messages in console:

Traceback (most recent call last):
    File "/PATH_TO_APP/APP.app/Contents/Resources/__boot__.py", line 3
        _recipes_pil_prescript(['Hdf5SubImagePlugin', 'FitsStubImagePlugin', 'SunImagePlugin', 'GbrImagePlugin', 'Jpeg2KImagePlugin', 'MicImagePlugin', 'FpxImagePlugin', ImImagePlugin', ...
    File "/PATH_TO_APP/APP.app/Contents/Resources/__boot__.py, line 3
        from PIL import Image
    File "PIL/Image.pyc", line 62, in <module>
    File "PIL/_imaging.pyc", line 14, in <module>
    File "PIL/_imaging.pyc", line 10, in __load
ImportError: dlopen(/PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so, 2): Symbol not found: ___sincos_stret
    Referenced from /PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so
    Expected in: /usr/lib/libSystem.B.dylib
    in /PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so

Earlier, to get around this error, I just uninstalled pillow. I'm not sure why pillow libraries were being added to the app to begin with, since I didn't think I was using it. But now, when attempting this workaround, I get another error:

Traceback (most recent call last):
    File "/PATH_TO_APP.app/APP.app/Contents/Resources/__boot__.py", line 384, in <module> _recipes_pil_prescript([])
    File "/PATH_TO_APP.app/APP.app/Contents/Resources/__boot__.py", line 344, in _recipes_pil_prescript from PIL import Image
    File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 62, in <module>
ImportError cannot import name _imaging

Apparently I'm using PIL now somehow. My script imports the following:

from __future__ import division
import easygui as eg
import os, zlib, re, datetime, getpass, tkMessageBox, sys
import zipfile as z
import Tkinter as tk
from tkFileDialog import askdirectory
from optparse import OptionParser

Here's my setup.py:

from setuptools import setup

APP = ['zipperscript.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'excludes': ['']}

setup(
    app=APP,
    name="Zipperscript_HI_50",
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    version="Hawaii branch 4.0.50"
)

I'm not sure that the OS version is causing the problem, but that's my theory right now. I'm not sure how to proceed. Any help or suggestions are greatly appreciated.

Community
  • 1
  • 1
joe
  • 31
  • 2
  • Problem solved.. sort of. I added PIL to the exclude list in setup.py. Unfortunately, there's a good chance I'll be asked to manipulate images down the road... So this is just a temporary solution, unless there's a PIL alternative that doesn't use PIL. – joe Oct 13 '14 at 16:09
  • I need to manipulate images now. If anyone has any insight at all, I'd really appreciate it. – joe Nov 18 '14 at 16:55
  • Follow up in the off chance someone else has the same problem. I installed an older version of OS X on a removable HDD that I boot off of when I need to build. It's annoying but it works. – joe Jun 19 '15 at 13:23
  • I am experiencing the same problem. Ill post here if I find anything – Chris Lucian Jan 14 '16 at 04:32

1 Answers1

0

I encountered a similar problem while using buildout on Mac OS 10.8.5. It seems that the pre-compiled packages available on Pypi have been compiled on newer versions of OS X and unfortunately insufficiently tested on older versions.

The solution is to install pillow from source instead. Download the source, and run pip install your_downloaded_file. You may need to install dependencies such as libjpeg and zlib beforehand.

After doing this I do not encounter the errors anymore and have pillow version 5.4.0 installed.

Thomas
  • 1