Symbol not found: _PyObject_REPR on Python 3.5

Issue #137 resolved
Jason R. Coombs
created an issue

I recently installed Python 3.5.0 from python.org. I also installed the latest Setuptools.

I than ran easy_install pyobjc (which took forever due to the #21).

The install completed without error, but fails to import:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyobjc_core-3.0.4-py3.5-macosx-10.6-intel.egg/objc/__init__.py", line 18, in <module>
    _update()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyobjc_core-3.0.4-py3.5-macosx-10.6-intel.egg/objc/__init__.py", line 15, in _update
    import objc._objc as _objc
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyobjc_core-3.0.4-py3.5-macosx-10.6-intel.egg/objc/_objc.cpython-35m-darwin.so, 2): Symbol not found: _PyObject_REPR
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyobjc_core-3.0.4-py3.5-macosx-10.6-intel.egg/objc/_objc.cpython-35m-darwin.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyobjc_core-3.0.4-py3.5-macosx-10.6-intel.egg/objc/_objc.cpython-35m-darwin.so

I'm using OS X Yosemite 10.10.5 and Xcode 7.0 (upgraded from 6.x).

I do not recall if I had installed the Command Line Developer Tools on XCode 6.x. I did not install them for 7.x.

I had previously installed some version of pyobjc on this system for Python 3.4 and XCode 6 with success, though I've since removed both applications.

What's the next step to troubleshoot?

Comments (26)

  1. Mark Szumowski

    I see the same thing on OS X 10.9.5 / XCode Version 6.2 (6C131e) / homebrew python3, pyobjc-core then pyobjc installed with pip.

    Python 3.5.0 (default, Sep 14 2015, 03:00:58)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import objc
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "</my/virtual/env>/lib/python3.5/site-packages/objc/__init__.py", line 18, in <module>
        _update()
      File "</my/virtual/env>/lib/python3.5/site-packages/objc/__init__.py", line 15, in _update
        import objc._objc as _objc
    ImportError: dlopen(</my/virtual/env>/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so, 2): Symbol not found: _PyObject_REPR
      Referenced from: </my/virtual/env>/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so
      Expected in: flat namespace
     in </my/virtual/env>/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so
    
  2. Kentzo

    In Python 3.5 PyObject_REPR was removed:

    • Removed non-documented macro :c:macro:PyObject_REPR which leaked references. Use format character %R in :c:func:PyUnicode_FromFormat-like functions to format the :func:repr of the object. (Contributed by Serhiy Storchaka in :issue:22453.)
  3. David Becher

    I stumbled across the same bug when I upgraded to Python 3.5. I had a look at the News.text in pyobjc-core and noticed that pyobjc-core 3.0.5 is already finished and 3.1 seems to be finished too (or at least still under development).

    1. Why hasn't version 3.0.5 of pyobjc-core not already been released to PyPI so that everyone can download it with pip?
    2. With pip, am I able to install local tar.gz-files as well, meaning I could download the latest version of pyobjc-core, pack it into an archive-file and then it is ready to be installed by pip?
  4. Jason R. Coombs reporter

    @David Becher Regarding (1), with most open-source projects, they're volunteer-supported, which means there are often delays as we wait for small teams or individuals to find the time to address issues.

    To (2), if you have XCode installed, you can probably simply pip install $LINK where $LINK is the URL of the source tarball, such as published by Kentzo above. Do exercise the same caution installing a package from a third party source as you would to installing an Application downloaded from that site. It may also be possible to install from the source repo directly using pip. I recommend installing from Kentzo's archive.

  5. Jason R. Coombs reporter

    I just reinstalled my Python (due to an unrelated corruption issue), and I installed pyobjc-core only to find this bug still exists. We all would really appreciate a release.

  6. Nick Devenish

    Which has now been denied. Has there been any movement on this project at all in the stated timespan? It's a little disheartening to find such a major bug going unrecognised for six months, make me wonder if the project is at all still alive/worth investing any time in.

  7. Jason R. Coombs reporter

    This issue is made more annoying by the fact that pip will uninstall 3.0.5.dev0 and reinstall pyobjc-core 3.0.4 whenever a dependency is installed. For example, if after having pyobjc-core 3.0.5.dev0 installed and working, but then I uninstall and reinstall jaraco.clipboard, pip will install the broken version of pyobjc-core, requiring me to reinstall the patched version (which takes a long time due to compiling).

    Installing collected packages: jaraco.clipboard, pyobjc-core
      Found existing installation: pyobjc-core 3.0.5
        Uninstalling pyobjc-core-3.0.5:
          Successfully uninstalled pyobjc-core-3.0.5
      Running setup.py install for pyobjc-core ... done
    Successfully installed jaraco.clipboard-1.1.2 pyobjc-core-3.0.4
    
  8. Log in to comment