Search code examples
pythonpyobjc

Issue with Installing PyObjC for Python


I was attempting to install PyObjC on my Mac OS X El Capitan, and about 40 minutes into the download, I received an error and it stopped. I tried installing using the following code in my terminal:

pip install pyobjc

The error says:

Command python setup.py egg_info failed with error code 1 in
/private/var/folders/6x/pl46qrrj2n51fs9z00cw46240000gn/T/pip_build_Dustin/pyobjc-framework
-AVKit
 Storing debug log for failure in /Users/Dustin/Library/Logs/pip.log

I am using Xcode Version 7.3 and have been searching online for some answers but have been unable to find anything that seems to help. Any suggestions as to how to get the download to complete?


Solution

  • You are using Python 2.7, but from the logs, it appears as though you're trying to install pyobjc for a different version, most probably Python 3.

    Line 267: pkg_resources.VersionConflict: (pyobjc-core 2.5.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC), Requirement.parse('pyobjc-core>=3.1.1'))

    If you wish to use Python 3, use this method to install:

    python3 -m pip install pyobj
    

    Alternatively, I suggest you go ahead and download pyobjc from here, and install it manually from the source using this command:

    • For Python 2.7: python2.7 pyobjc/install.py
    • For Python 3.x: python3 pyobjc/install.py

    The documentations here and here, clearly explain the installation process in further details. The latter deals with some possible problems, too.

    Another alternative is to try easy_install:

    python -m easy_install pyobjc
    

    Note

    Please ensure that you have commandline-tools from xcode installed before attempting to install pyobjc. Also, make sure that you run this in your terminal beforehand if you use Mac OS X 10.8 or lower.

     xcode-select --install.
    

    Finally, it might be a good idea to install the core separately:

    python2.7 -m pip install -U pyobjc-core
    python2.7 -m pip install -U pyobjc
    

    Lets try these and see if they work!