OS X 10.11 issues

Issue #128 resolved
Rob K
created an issue

Hi Ronald, been using PyObjC for about a year in a project, it's great.

I installed the OS X 10.11 beta and suddenly the app stopped working, stacktrace:

  ...
  File "<frozen importlib._bootstrap>", line 2281, in _handle_fromlist
  File "objc/_lazyimport.pyo", line 139, in getattr
  File "objc/_lazyimport.pyo", line 312, in __get_constant
ValueError: Don't know CF type for typestr '^{OpaqueLSSharedFileListItemRef=}', cannot create special wrapper

I tried uninstalling then using pip to install (3.0.4) same result, then tried manually installing the latest version from BitBucket, but I get a similar error pyobjc_core-3.1b1-py3.4-macosx-10.6-x86_64.egg/objc/_lazyimport.py"

I do get some errors when trying to install

Use 'clang' instead of 'gcc-4.2' as the compiler

building 'AddressBook._AddressBook' extension

creating build/temp.macosx-10.6-x86_64-3.4/Modules

clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Ibuild/temp.macosx-10.6-x86_64-3.4/pyobjc-include -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c Modules/_AddressBook.m -o build/temp.macosx-10.6-x86_64-3.4/Modules/_AddressBook.o -DPyObjC_BUILD_RELEASE=1011 -isysroot /

In file included from Modules/_AddressBook.m:3:

In file included from build/temp.macosx-10.6-x86_64-3.4/pyobjc-include/pyobjc-api.h:21:

In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:

In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:6:

/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:15: error: expected ';' after @class

@class NSArray<ObjectType>;

              ^

/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:16: error: cannot find protocol declaration for 'ObjectType'

@class NSArray<ObjectType>;

               ^

/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:25: error: cannot find protocol declaration for 'ObjectType'

@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>

Any ideas? If you need any more information please let me know.

Thanks, Robert

Comments (18)

  1. Ronald Oussoren repo owner

    You need to change the framework wrapper for LaunchServices. The init.py for that now loads LaunchServices.frameworks, it should look /System/Library/Frameworks/CoreServices.framework instead.

    I don't have a solution for the problem with the address book bindings. I haven't installed 10.11 myself yet, put possibly this can be fixed by patching the sources for Modules/_Addressbook.m in those bindings, add '#import <Foundation/Foundation.h>' before the #import statement for AddressBook.

  2. Rob K reporter

    You need to change the framework wrapper for LaunchServices. The init.py for that now loads LaunchServices.frameworks, it should look /System/Library/Frameworks/CoreServices.framework instead.

    I don't know much/anything about Mac, so struggling a little with this. Do you mean change the framework path in /pyobjc-framework-LaunchServices/Lib/LaunchServices/init.py

    Installing the 10.11 Beta went fine for me (if a little lengthy), haven't encountered any other problems with other software (yet).

  3. Ronald Oussoren repo owner

    That's correct.

    The problem is that Apple has moved LaunchServices symbols to a different sub framework of CoreServices and PyObjC still revers to the old location. It shouldn't have done so in the first place, the public entry point is CoreServices.framework :-(

  4. Rob K reporter

    I made some progress, update the init.py file, but ran into more errors, working through them I realised that I had the previous version of Xcode. After upgrading to the latest Xcode 7 beta 4, it resolved a number of the syntax errors, at least now using pip3 install pyobjc it builds without any errors. However, building from sources (python3 install.py) now it throws a file missing type error.

    clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-x86_64-3.4/Modules/_coregraphics.o -o build/lib.macosx-10.6-x86_64-3.4/Quartz/CoreGraphics/_coregraphics.so -framework ApplicationServices -isysroot /
    building 'Quartz.ImageKit._imagekit' extension
    clang -fno-strict-aliasing -Werror=declaration-after-statement -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Ibuild/temp.macosx-10.6-x86_64-3.4/pyobjc-include -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c Modules/_imagekit.m -o build/temp.macosx-10.6-x86_64-3.4/Modules/_imagekit.o -DPyObjC_BUILD_RELEASE=1011 -isysroot /
    clang: error: no such file or directory: 'Modules/_imagekit.m'
    clang: error: no input files
    error: command 'clang' failed with exit status 1
    Installing 'pyobjc-framework-Quartz' failed (status 1)
    
  5. Rob K reporter

    Hi Ronald, just wondering, is there any update on this? I saw in issue #126 you were thinking of doing a bug fix release before the 10.11 release... this would be great (rather than waiting for the 10.11 release), as without this fix cannot test the rest of the app to see if there are any other 10.11 issues with other components.

    So any ETA on 3.0.5?

    Thanks! :)

  6. Mike Boyle

    Just to clarify: I was trying to build it from the current repo version, not the current release. (I tried this because I was running into #111, which was resolved after the current release.)

  7. Ronald Oussoren repo owner

    The version in the repo does not yet build on OS X 10.11, and some framework wrappers seem to have problems. I have not yet have had time to seriously look into fixing these problems, although I do have a vm running 10.11 by now.

    Fixing the problems is likely an evening's worth of work, and any time I have been able to work on pyobjc has been focussed on working my way through the SDK headers to update the framework bindings for OSX 10.11. That's currently a lot of boring work and with some luck should be easier in the future.

    Ronald

    -- On the road, hence brief.

  8. Mateusz Mikusz

    Hi,

    First of all thank you for all your work and effort you put in to pyobjc!

    These past days I was playing around with pyobjc on El Capitan for a little bit as we are trying to migrate a project that we had written years ago from Python3.2 and pyobjc 2.3 to the latest versions of Python (either 3.4 or 3.5) and pyobjc 3.0.4 or 3.0.5.

    This turned out to be a little bit tricky -- I believe a lot things have changed in the meantime. To narrow down the issues I ran pyobjc unit tests on El Capitan with both Python 3.4 and Python 3.5. I thought it could be useful to share the result with you.

    El Capital, Python 3.4 and pyobjc 3.0.4 (the current version on PyPi) gives the following result:

    ======================================================================
    ERROR: test_frame_readline (PyObjCTest.test_archive_python.TestKeyedArchivePlainPython)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/pickletester.py", line 1547, in test_frame_readline
        self.assertEqual(self.loads(pickled), 42)
      File "/Users/xxx/pyobjc_source 3.0.4/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py", line 765, in loads
        return NSKeyedUnarchiver.unarchiveObjectWithData_(buf)
    ValueError: NSInvalidArgumentException - *** -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0xffffff80, 0x4, 0xffffff95, 0x5, 0x0, 0x0, 0x0, 0x0)
    
    ======================================================================
    ERROR: test_misc_globals (PyObjCTest.test_archive_python.TestKeyedArchiveSimple)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/xxx/pyobjc_source 3.0.4/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py", line 247, in test_misc_globals
        self.assertRaises(ValueError, self.unarchiverClass.unarchiveObjectWithData_, buf)
      File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/case.py", line 704, in assertRaises
        return context.handle('assertRaises', callableObj, args, kwargs)
      File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/case.py", line 162, in handle
        callable_obj(*args, **kwargs)
    objc.error: OC_PythonException - <class 'ValueError'>: unregistered extension code 42
    
    ======================================================================
    ERROR: test_unknown_type (PyObjCTest.test_archive_python.TestKeyedArchiveSimple)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/xxx/pyobjc_source 3.0.4/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py", line 156, in test_unknown_type
        self.assertRaises(pickle.UnpicklingError, self.unarchiverClass.unarchiveObjectWithData_, buf)
      File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/case.py", line 704, in assertRaises
        return context.handle('assertRaises', callableObj, args, kwargs)
      File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/case.py", line 162, in handle
        callable_obj(*args, **kwargs)
    objc.error: OC_PythonException - <class '_pickle.UnpicklingError'>: Unknown object kind: 2
    
    ======================================================================
    FAIL: test_frame_readline (PyObjCTest.test_archive_python.TestArchivePlainPython)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/pickletester.py", line 1547, in test_frame_readline
        self.assertEqual(self.loads(pickled), 42)
    AssertionError: None != 42
    
    ======================================================================
    FAIL: testLongValue (PyObjCTest.test_number_proxy.TestNSNumber)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/xxx/pyobjc_source 3.0.4/pyobjc/pyobjc-core/PyObjCTest/test_number_proxy.py", line 56, in testLongValue
        self.assertEqual(v.description(), str(-2**63+5000))
    AssertionError: '9223372036854780808' != '-9223372036854770808'
    
    ======================================================================
    FAIL: testPickling (PyObjCTest.test_number_proxy.TestNSNumber)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/xxx/pyobjc_source 3.0.4/pyobjc/pyobjc-core/PyObjCTest/test_number_proxy.py", line 104, in testPickling
        'float': 2.0,
    AssertionError: {'int': 42, 'float': 2.0, 'long': 9223372036854780808} != {'int': 42, 'float': 2.0, 'long': -9223372036854770808}
    - {'float': 2.0, 'int': 42, 'long': 9223372036854780808}
    ?                                                 ^
    
    + {'float': 2.0, 'int': 42, 'long': -9223372036854770808}
    ?                                   +              ^
    
    
    ----------------------------------------------------------------------
    Ran 3601 tests in 180.712s
    
    FAILED (failures=3, errors=3, skipped=107, expected failures=10)
    SUMMARY: {'xpass': 0, 'count': 3601, 'errors': 3, 'fails': 3, 'xfails': 10, 'skip': 107}
    error: some tests failed
    

    Running pyobjc 3.0.5 (patched version from here) leads to a few more errors indicating that there may be some compatibility issues with Python 3.5:

    Ran 3616 tests in 248.598s
    
    FAILED (failures=56, errors=10, skipped=107, expected failures=10)
    SUMMARY: {'xfails': 10, 'fails': 56, 'errors': 10, 'xpass': 0, 'skip': 107, 'count': 3616}
    error: some tests failed
    

    I'm more than happy to share the full output of the unit tests if this would be at all useful. Generally, even though some unit tests fail, pyobjc does seem to work: I was able to get quick examples working with both Python 3.4 and Python 3.5 on El Capitan.

    Our project, however, still doesn't work and is failing when we are trying to create a class that extends AppKit.NSObject ("TypeError: Objective-C callable methods must take at least one argument") but this probably doesn't quite belong here :-)

  9. Mateusz Mikusz

    You shouldn't have to use sudo when installing PyObjC into a virtual environment though. This suggests that there might be something not quite right with your local setup but has nothing to do with PyObjC.

  10. Gary Church

    Hello,

    I'm trying to install pyobjc on OSX 10.11.4 but am having an issue.

    I first tried installing with pip. Using pip, pyobjc-core installed fine but pyobjc did not. Running 'pip install pyobjc', I got 3 errors:

    Failed building wheel for pyobjc-framework-MapKit Failed building wheel for pyobjc-framework-Quartz Failed building wheel for pyobjc-framework-CoreLocation

    and at the end of the failed compile:

    Command "/Users/gary/anaconda/envs/py3k/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/sr/njmfs9h101gf0k6h8qykh26m0000gn/T/pip-build-j248o_nm/pyobjc-framework-CoreLocation/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/sr/njmfs9h101gf0k6h8qykh26m0000gn/T/pip-3dg2_5x2-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/sr/njmfs9h101gf0k6h8qykh26m0000gn/T/pip-build-j248o_nm/pyobjc-framework-CoreLocation/

    I then tried manually installing pyobjc by installing (in order):

    pyobjc-core-3.1.1 pyobjc-framework-Cocoa-3.1.1 pyobjc-framework-Quartz-3.1.1

    by running python3 setup.py install from each directory. pyobjc-core and pyobjc-framework-Cocoa seem to have installed without problem. However, when I tried installing pyobjc-framework-Quartz, I got the following:

    building 'Quartz.ImageKit._imagekit' extension gcc -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/gary/anaconda/envs/py3k/include -arch x86_64 -Ibuild/temp.macosx-10.5-x86_64-3.5/pyobjc-include -I/Users/gary/anaconda/envs/py3k/include/python3.5m -c Modules/_imagekit.m -o build/temp.macosx-10.5-x86_64-3.5/Modules/_imagekit.o -DPyObjC_BUILD_RELEASE=1011 -isysroot / In file included from Modules/_imagekit.m:9: Modules/_ImageKit_protocols.m:11:28: error: cannot find protocol declaration for 'IKCameraDeviceViewDelegate' p = PyObjC_IdToPython(@Haiyang SI(IKCameraDeviceViewDelegate)); Py_XDECREF(p); ^ Modules/_ImageKit_protocols.m:12:28: error: cannot find protocol declaration for 'IKDeviceBrowserViewDelegate' p = PyObjC_IdToPython(@Haiyang SI(IKDeviceBrowserViewDelegate)); Py_XD... ^ Modules/_ImageKit_protocols.m:13:28: error: cannot find protocol declaration for 'IKScannerDeviceViewDelegate' p = PyObjC_IdToPython(@Haiyang SI(IKScannerDeviceViewDelegate)); Py_XD... ^ 3 errors generated. error: command 'gcc' failed with exit status 1

    Any ideas what my problems might be and any ideas for a fix?

    Thanks much, Gary

  11. Matt Olsen

    Its possible I'm doing something wrong but I'm still having trouble getting this to work correctly. Inside a virtual env when I run:

    $ pip install pyobjc

    I get:

    Modules/_ImageKit_protocols.m:11:28: error: cannot find protocol declaration for 'IKCameraDeviceViewDelegate'
        p = PyObjC_IdToPython(@protocol(IKCameraDeviceViewDelegate)); Py_XDECREF(p);
                               ^
    Modules/_ImageKit_protocols.m:12:28: error: cannot find protocol declaration for 'IKDeviceBrowserViewDelegate'
        p = PyObjC_IdToPython(@protocol(IKDeviceBrowserViewDelegate)); Py_XDECREF(p);
                               ^
    Modules/_ImageKit_protocols.m:13:28: error: cannot find protocol declaration for 'IKScannerDeviceViewDelegate'
        p = PyObjC_IdToPython(@protocol(IKScannerDeviceViewDelegate)); Py_XDECREF(p);
                               ^
    3 errors generated.
    error: command 'gcc' failed with exit status 1
    

    I can see that this is fetching 3.1.1

    Collecting pyobjc Using cached pyobjc-3.1.1.tar.gz

  12. jameerbh

    Hi,

    I'm unable to install 'pyobjc-core' on Mac Osx EI Capitan (10.11.5). I have Xcode 7.3.1, Python 2.7 and pip 8.1.2 on my system.

    Modules/objc/objc-runtime-compat.m:885:17: error: cannot find interface declaration for 'Object'; did you mean 'NSObject'?
    @implementation Object (NSObjectCompat)
                    ^~~~~~
                    NSObject
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/objc/NSObject.h:53:12: note: 'NSObject' declared here
    @interface NSObject <NSObject> {
               ^
    Modules/objc/objc-runtime-compat.m:891:1: warning: method has no return type specified; defaults to 'id' [-Wmissing-method-return-type]
    -doesNotRecognizeSelector:(SEL)sel
    ^
     (id)
    Modules/objc/objc-runtime-compat.m:886:1: warning: category is implementing a method which will also be implemented by its primary class [-Wobjc-protocol-method-implementation]
    - (id)self
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/objc/NSObject.h:22:1: note: method 'self' declared here
    - (instancetype)self;
    ^
    2 warnings and 1 error generated.
    error: command '//usr/bin/clang' failed with exit status 1
    
  13. Log in to comment