Resolve issue "No Qt bindings could be found" on Git-cola (OSX)

I am using OSX and I wanted to install git-cola for manage my Git projects. Unfortunately, after installing python using brew, I could not run it. When typing git cola to terminal, I kept getting the following error message:

Traceback (most recent call last):
  File "/usr/local/bin/git-cola", line 53, in <module>
    from cola.main import main
  File "/usr/local/Cellar/git-cola/2.8/share/git-cola/lib/cola/", line 9, in <module>
    from .app import add_common_arguments
  File "/usr/local/Cellar/git-cola/2.8/share/git-cola/lib/cola/", line 32, in <module>
    from qtpy import QtCore
  File "/usr/local/Cellar/git-cola/2.8/share/git-cola/lib/qtpy/", line 125, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

As you can see from the above code, the error occurred when I was trying to run the command git cola, which is actually a shortcut to the executable file /usr/local/bin/git-cola (you can see that from the first line of the error message). Realizing that this file was actually a Python file, I tried the following command to see if it would work or not:

python /usr/local/bin/git-cola

Strangely this command executed well without any issue, git-cola started and the window showed up. Hmm, I asked myself: why this command works?

First of all, you should understand that we can execute the following command directly without prefixing it with the python command in the terminal:


This file is executable thanks to the first line in its content, which is a directive for Unix system to know which "program" to run this file. This is called Shebang on Unix. It looks like this:


It means that this file will be run by the program /usr/bin/sh. So back to our /usr/local/bin/git-cola file, here is its original Shebang


This is the default Python interpreter on Mac OSX. Because I know I have been writing a lot of Python code recently so perhaps I installed some other Python version on my computer. Hence I checked for the current default Python of my system

which python

And it showed:


Yeah, now I know the reason. The MacOSX's default Python interpreter is not compatible with git-cola, but my current python interpreter is okay. Why? I do not know exactly the reason. At that moment, I just wanted git-cola to work, so I simply changed the Shebang on /usr/local/bin/git-cola to like this:


And I ran git cola again on my terminal, the git cola window showed up beautifully.