git-cola icon indicating copy to clipboard operation
git-cola copied to clipboard

No module named 'PySide', running on Macbook pro(Big Sur)

Open anil-tiwari opened this issue 4 years ago • 10 comments

$ git cola Traceback (most recent call last): File "/usr/local/Cellar/git-cola/3.9_1/share/git-cola/lib/qtpy/init.py", line 204, in from PySide import version as PYSIDE_VERSION # analysis:ignore ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/git-cola", line 40, in from cola.main import main File "/usr/local/Cellar/git-cola/3.9_1/share/git-cola/lib/cola/main.py", line 6, in from . import app File "/usr/local/Cellar/git-cola/3.9_1/share/git-cola/lib/cola/app.py", line 16, in from qtpy import QtCore File "/usr/local/Cellar/git-cola/3.9_1/share/git-cola/lib/qtpy/init.py", line 210, in raise PythonQtError('No Qt bindings could be found') qtpy.PythonQtError: No Qt bindings could be found

==== I Already install below library to make it resolve but it's now working :

  • pip3 install pyqt5==5.12 --user
  • pip3 install pyqtwebengine==5.12 --user

Please help to resolve the issue.

anil-tiwari avatar Mar 24 '21 08:03 anil-tiwari

Have you tried reinstalling your brew dependencies lately?

https://github.com/git-cola/git-cola/#upgrading-using-homebrew

(sug: never use pip install unless you're using a virtualenv. it litters junk in your $HOME and might break other tools)

davvid avatar Mar 24 '21 20:03 davvid

Thanks its working

anil-tiwari avatar Mar 25 '21 00:03 anil-tiwari

Hi, I have the same error but the upgrade steps don't fix it on my end.

Here is my log:

# brew reinstall pyqt@5
==> Downloading https://ghcr.io/v2/homebrew/core/pyqt/5/manifests/5.15.4_2
Already downloaded: /Users/dorian/Library/Caches/Homebrew/downloads/b6daa3d1e47faf6d1c850b3a91b711ebf3beb122208b1f2042734bd6f85aee8c--pyqt@5-5.15.4_2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/pyqt/5/blobs/sha256:57e1fd479cc069392daab557c213607bcb45fae6494fce0898803be3696bb24b
Already downloaded: /Users/dorian/Library/Caches/Homebrew/downloads/29a526814d71749005114faef0793c995e98df29b6c770d6ce85812da90f2efb--pyqt@5--5.15.4_2.big_sur.bottle.tar.gz
==> Reinstalling pyqt@5
==> Pouring [email protected]_2.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/pyqt@5/5.15.4_2: 1,327 files, 31.6MB

# brew link pyqt@5
Warning: Already linked: /usr/local/Cellar/pyqt@5/5.15.4_2
To relink, run:
  brew unlink pyqt@5 && brew link pyqt@5

# brew unlink pyqt@5 && brew link pyqt@5
Unlinking /usr/local/Cellar/pyqt@5/5.15.4_2... 1321 symlinks removed.
Linking /usr/local/Cellar/pyqt@5/5.15.4_2... 1321 symlinks created.

# git-cola
Traceback (most recent call last):
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/qtpy/__init__.py", line 204, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/git-cola", line 40, in <module>
    from cola.main import main
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/cola/main.py", line 6, in <module>
    from . import app
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/cola/app.py", line 16, in <module>
    from qtpy import QtCore
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/qtpy/__init__.py", line 210, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

# brew update
Already up-to-date.

# brew uninstall git-cola
Uninstalling /usr/local/Cellar/git-cola/3.10.1... (389 files, 3.5MB)

# brew uninstall pyqt5
Uninstalling /usr/local/Cellar/pyqt@5/5.15.4_2... (1,327 files, 31.6MB)

# brew uninstall sip
Error: Cask 'sip' is not installed.

# brew install git-cola
==> Downloading https://ghcr.io/v2/homebrew/core/pyqt/5/manifests/5.15.4_2
Already downloaded: /Users/dorian/Library/Caches/Homebrew/downloads/b6daa3d1e47faf6d1c850b3a91b711ebf3beb122208b1f2042734bd6f85aee8c--pyqt@5-5.15.4_2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/pyqt/5/blobs/sha256:57e1fd479cc069392daab557c213607bcb45fae6494fce0898803be3696bb24b
Already downloaded: /Users/dorian/Library/Caches/Homebrew/downloads/29a526814d71749005114faef0793c995e98df29b6c770d6ce85812da90f2efb--pyqt@5--5.15.4_2.big_sur.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/git-cola/manifests/3.10.1
Already downloaded: /Users/dorian/Library/Caches/Homebrew/downloads/bf29f612410fd25438d74fd16cb424e4bd024c256ba117a756295c7b5d042d0b--git-cola-3.10.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/git-cola/blobs/sha256:a7c75d4c5c2b43d3f2b2fb57b9f26e0d95933e2b94dc2b6cf7e24ea8b91a5da6
Already downloaded: /Users/dorian/Library/Caches/Homebrew/downloads/d0ffa25cf2af1712785fb6837733b95588b27d61c74013dab2fc1212b73dc335--git-cola--3.10.1.big_sur.bottle.tar.gz
==> Installing dependencies for git-cola: pyqt@5
==> Installing git-cola dependency: pyqt@5
==> Pouring [email protected]_2.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/pyqt@5/5.15.4_2: 1,327 files, 31.6MB
==> Installing git-cola
==> Pouring git-cola--3.10.1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/git-cola/3.10.1: 384 files, 3.5MB

# git-cola
Traceback (most recent call last):
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/qtpy/__init__.py", line 204, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/git-cola", line 40, in <module>
    from cola.main import main
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/cola/main.py", line 6, in <module>
    from . import app
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/cola/app.py", line 16, in <module>
    from qtpy import QtCore
  File "/usr/local/Cellar/git-cola/3.10.1/share/git-cola/lib/qtpy/__init__.py", line 210, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

dorian-marchal avatar Aug 12 '21 07:08 dorian-marchal

More info, maybe this can help someone help me 🙏

$ brew info git-cola
git-cola: stable 3.10.1 (bottled), HEAD
Highly caffeinated git GUI
https://git-cola.github.io/
/usr/local/Cellar/git-cola/3.10.1 (394 files, 3.6MB) *
  Poured from bottle on 2021-08-12 at 09:47:17
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/git-cola.rb
License: GPL-2.0-or-later
==> Dependencies
Build: sphinx-doc ✘
Required: pyqt@5 ✔, [email protected] ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 761 (30 days), 1,692 (90 days), 7,570 (365 days)
install-on-request: 759 (30 days), 1,691 (90 days), 7,479 (365 days)
build-error: 0 (30 days)


$ brew info pyqt5
pyqt@5: stable 5.15.4 (bottled)
Python bindings for v5 of Qt
https://www.riverbankcomputing.com/software/pyqt/intro
/usr/local/Cellar/pyqt@5/5.15.4_2 (1,327 files, 31.6MB) *
  Poured from bottle on 2021-08-12 at 09:53:57
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
License: GPL-3.0-only
==> Dependencies
Build: pyqt-builder ✘, sip ✘
Required: [email protected] ✔, qt@5 ✔
==> Analytics
install: 14,636 (30 days), 55,033 (90 days), 106,819 (365 days)
install-on-request: 1,817 (30 days), 6,578 (90 days), 10,615 (365 days)
build-error: 0 (30 days)

$ which python3
/usr/local/bin/python3

$ ls -l /usr/local/bin/python3
lrwxr-xr-x  1 dorian  admin  38 Aug 12 09:04 /usr/local/bin/python3 -> ../Cellar/[email protected]/3.9.6/bin/python3

dorian-marchal avatar Aug 12 '21 08:08 dorian-marchal

What does head -n1 /usr/local/bin/git-cola show?

If you run python3 and type from PyQt5 import QtCore does that work?

If the #! line shows "python" instead of "python3" then the homebrew recipe may need updating.

It's interesting that pyqt-builder has an x next to it, as does sip. I haven't looked at homebrew in a while.

@chenrui333 it looks like you might know a bit about the homebrew recipes. Sorry to bring you in here but maybe you might know what's going on. Context: we have a section in our README.md with some (dated?) notes about how users can manage their homebrew cola install.

A quick fix may be to brew install pyqt@5 since from the looks of it that should satisfy the dependencies. What does brew info pyqt@5 report?

Here's a quick way to get a running version for testing purposes. We can work towards improving the "upgrade" instructions once we figure out the brew solution.

If running brew install pyqt5 (or pyqt@5) gets things running then we'll have to add that to the upgrade instructions, but I imagined that running brew install git-cola would already handle dependencies. 🤔

python3 -m venv env39
./env39/bin/pip install PyQt5
./env39/bin/python ./bin/git-cola

davvid avatar Aug 17 '21 03:08 davvid

I looked at the homebrew recipe and it already specifies a custom make PYTHON=... python interpreter so in theory it should already be doing the right thing.

davvid avatar Aug 17 '21 03:08 davvid

let me also take a look.

chenrui333 avatar Aug 17 '21 05:08 chenrui333

$ brew reinstall pyqt@5
==> Downloading https://ghcr.io/v2/homebrew/core/pyqt/5/manifests/5.15.4_2
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/b6daa3d1e47faf6d1c850b3a91b711ebf3beb122208b1f2042734bd6f85aee8c--pyqt@5-5.15.4_2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/pyqt/5/blobs/sha256:d824441486b767137fcad5620117299a7e3dd1423726a31c637cde4b1fcf2d3
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/96989f7ff46a250b88e37f375666ebfdf2c6d57bb11b5b8809eb9a36b6e6dcde--pyqt@5--5.15.4_2.mojave.bottle.tar.gz
==> Reinstalling pyqt@5
==> Pouring [email protected]_2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/pyqt@5/5.15.4_2: 1,327 files, 31MB

$ brew reinstall git-cola
==> Downloading https://ghcr.io/v2/homebrew/core/git-cola/manifests/3.10.1
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/bf29f612410fd25438d74fd16cb424e4bd024c256ba117a756295c7b5d042d0b--git-cola-3.10.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/git-cola/blobs/sha256:a7c75d4c5c2b43d3f2b2fb57b9f26e0d95933e2b94dc2b6cf7e24ea8b91a5
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/d0ffa25cf2af1712785fb6837733b95588b27d61c74013dab2fc1212b73dc335--git-cola--3.10.1.mojave.bottle.tar.gz
==> Reinstalling git-cola
==> Pouring git-cola--3.10.1.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/git-cola/3.10.1: 384 files, 3.5MB

$ git-cola --version
cola version 3.10.1

it works fine for my mojave machine.

chenrui333 avatar Aug 17 '21 05:08 chenrui333

Thank you, I already fixed it on my side by installing python through asdf, but I'm not sure how this actually works.

FYI:

$ which python
/Users/dorian/.asdf/shims/python

What does head -n1 /usr/local/bin/git-cola show?

$ head -n1 /usr/local/bin/git-cola
#!/usr/local/opt/[email protected]/bin/python3.9

If you run python3 and type from PyQt5 import QtCore does that work? It works now, but before I had that:

$ /usr/local/bin/python3
Python 3.9.6 (default, Jun 29 2021, 05:25:02)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtCore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5'

A quick fix may be to brew install pyqt@5 since from the looks of it that should satisfy the dependencies. What does brew info pyqt@5 report?

I tried to reinstall pyqt@5 before that, but it didn't work. brew info:

$ brew info pyqt@5
pyqt@5: stable 5.15.4 (bottled)
Python bindings for v5 of Qt
https://www.riverbankcomputing.com/software/pyqt/intro
/usr/local/Cellar/pyqt@5/5.15.4_2 (1,327 files, 31.6MB) *
  Poured from bottle on 2021-08-12 at 09:53:57
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
License: GPL-3.0-only
==> Dependencies
Build: pyqt-builder ✘, sip ✔
Required: [email protected] ✔, qt@5 ✔
==> Analytics
install: 14,098 (30 days), 54,667 (90 days), 108,986 (365 days)
install-on-request: 1,712 (30 days), 6,617 (90 days), 10,880 (365 days)
build-error: 0 (30 days)
$ brew info pyqt5
pyqt@5: stable 5.15.4 (bottled)
Python bindings for v5 of Qt
https://www.riverbankcomputing.com/software/pyqt/intro
/usr/local/Cellar/pyqt@5/5.15.4_2 (1,327 files, 31.6MB) *
  Poured from bottle on 2021-08-12 at 09:53:57
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
License: GPL-3.0-only
==> Dependencies
Build: pyqt-builder ✘, sip ✘
Required: [email protected] ✔, qt@5 ✔
==> Analytics
install: 14,636 (30 days), 55,033 (90 days), 106,819 (365 days)
install-on-request: 1,817 (30 days), 6,578 (90 days), 10,615 (365 days)
build-error: 0 (30 days)

Sorry I probably won't be able to help you more than that right now as I'll try to avoid changing things now that it's working. 😬

dorian-marchal avatar Aug 17 '21 07:08 dorian-marchal

Oh, I forgot to say I am using pyenv to manage my python3 versions.

chenrui333 avatar Aug 17 '21 14:08 chenrui333

@davvid I recommend closing this issue, as it has been two years since the last update.

kurtmckee avatar Aug 25 '23 12:08 kurtmckee