andreasgrill / auto-selfcontrol

Small utility to schedule start and stop times of SelfControl
MIT License
304 stars 37 forks source link

Wrong version of PyObjC C API #23

Open bytrangle opened 6 years ago

bytrangle commented 6 years ago

Hi Andreas, I'm having this problem after running sudo /usr/bin/python auto-selfcontrol.py:

Traceback (most recent call last): File "auto-selfcontrol.py", line 10, in from Foundation import NSUserDefaults, CFPreferencesSetAppValue, CFPreferencesAppSynchronize, NSDate File "/Library/Python/2.7/site-packages/pyobjc_framework_Cocoa-3.2.1-py2.7-macosx-10.12-intel.egg/Foundation/init.py", line 9, in import CoreFoundation File "/Library/Python/2.7/site-packages/pyobjc_framework_Cocoa-3.2.1-py2.7-macosx-10.12-intel.egg/CoreFoundation/init.py", line 22, in import CoreFoundation._CoreFoundation RuntimeError: Wrong version of PyObjC C API (got 19, expected 20) Hope you can help.

XuankangLin commented 6 years ago

I am seeing the same issue on my mac (10.12.6). And this is likely due to dependency issue when running setup.py:

......
Processing dependencies for auto-selfcontrol==1.0
error: pyobjc-core 2.5.1 is installed but pyobjc-core==4.0b1 is required by set(['pyobjc'])

I tried to upgrade pyobjc and pyobjc-core in particular using pip, but the latest version on pip seems to be 3.2.1.

Any suggestions on this? Thanks.

ssent1 commented 6 years ago

I installed PyObjC Version 4.0 using easy_install. $ easy_install -U pyobjc-core

This was enough for me, but you might also have to install: $ easy_install -U pyobjc

Result: > SelfControl was started.

To get more info go to Installing PyObjC.

XuankangLin commented 6 years ago

@ssent1 Thanks but that doesn't work for me. I still have the pyobjc version mismatch problem following what you said.

But strangely I tried running using python3 and the problem is gone. Although using python3 to run the app would raise error while using python2 to run the app still exposes this pyobjc mismatch issue (RuntimeError: Wrong version of PyObjC C API (got 19, expected 20).

nickjmorrow-archived commented 6 years ago

@AndriyLin were you ever able to get it to work?

XuankangLin commented 6 years ago

@nickjmorrow No, it complained as before, so I stopped trying and removed the app.. 😓

oliverswitzer commented 6 years ago

Having the same issue. Still occurring after running

$ easy_install -U pyobjc-core
$ easy_install -U pyobjc
ghost commented 5 years ago

managed to fix it, start over -> manual install req. specific versions with previous xcode version, solved it.

lvwarren commented 2 years ago

As of the Big Sur update on October 12, 2021, after trying a lot of other solutions, this fixed it for me: pip install pyobjc-core==8.0b1 pip install pyobjc-framework-Cocoa==8.0b1 pip install pyobjc-framework-Quartz==8.0b1