#67694 closed defect (fixed)

git-cola@4.1.0: fails to launch

Reported by: odysseus9672 (Sean Lake) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: git-cola

Description

I have MacPorts version 2.8.1 installed, and git-cola 4.1.0. When I try to launch git-cola I get the following message:

git-cola

You do not seem to have PyQt (or PySide) and qtpy installed.
Please install the PyQt (or PySide) and qtpy into your Python environment.

For example, on a Debian/Ubuntu system you can install these using apt:

    sudo apt install python3-pyqt5 python3-pyqt5.qtwebkit python3-qtpy

When I examine /opt/local/bin/git-cola I see that it uses python3.11. Here is what I see when I look for qt related packages on my system:

port installed | grep -i qt
  gstreamer1-gst-plugins-good @1.16.2_5+gtk3+pulseaudio+qt+x11 (active)
  mkvtoolnix @77.0_0+qtgui (active)
  py38-pyqt5 @5.15.9_0 (active)
  py38-pyqt5-sip @12.12.1_0 (active)
  py38-qtpy @2.3.1_0 (active)
  py38-sphinxcontrib-qthelp @1.0.3_0 (active)
  py311-pyqt5 @5.15.9_0 (active)
  py311-pyqt5-sip @12.12.1_0 (active)
  py311-qtpy @2.3.1_0 (active)
  qt5 @5.15.10_0 (active)
  qt5-qt3d @5.15.10_0 (active)
  qt5-qtbase @5.15.10_0+openssl (active)
  qt5-qtconnectivity @5.15.10_0 (active)
  qt5-qtdeclarative @5.15.10_0 (active)
  qt5-qtgamepad @5.15.10_0 (active)
  qt5-qtgraphicaleffects @5.15.10_0 (active)
  qt5-qtimageformats @5.15.10_0 (active)
  qt5-qtlocation @5.15.10_0 (active)
  qt5-qtmacextras @5.15.10_0 (active)
  qt5-qtmultimedia @5.15.10_0 (active)
  qt5-qtnetworkauth @5.15.10_0 (active)
  qt5-qtquickcontrols @5.15.10_0 (active)
  qt5-qtquickcontrols2 @5.15.10_0 (active)
  qt5-qtremoteobjects @5.15.10_0 (active)
  qt5-qtscript @5.15.10_0 (active)
  qt5-qtscxml @5.15.10_0 (active)
  qt5-qtsensors @5.15.10_0 (active)
  qt5-qtserialbus @5.15.10_0 (active)
  qt5-qtserialport @5.15.10_0 (active)
  qt5-qtspeech @5.15.10_0 (active)
  qt5-qtsvg @5.15.10_0 (active)
  qt5-qttools @5.15.10_0 (active)
  qt5-qttranslations @5.15.10_0 (active)
  qt5-qtwebchannel @5.15.10_0 (active)
  qt5-qtwebsockets @5.15.10_0 (active)
  qt5-qtxmlpatterns @5.15.10_0 (active)
  qt5-sqlite-plugin @5.15.10_0 (active)
  qt6-qtbase @6.4.3_1+openssl (active)
  qt6-qtdeclarative @6.4.3_0 (active)
  qt6-qtimageformats @6.4.3_0 (active)
  qt6-qtlanguageserver @6.4.3_0 (active)
  qt6-qtshadertools @6.4.3_0 (active)
  qt6-qtsvg @6.4.3_0 (active)
  qt6-qttools @6.4.3_0 (active)
  qt6-qttranslations @6.4.3_0 (active)

As you can see, both py311-pyqt5 and py311-qtpy are installed.

I've tried looking for text files containing fragments of the error string git-cola is printing, but I cannot find them, so I don't know where the error is occurring. I, therefore, also cannot comment on whether this is a bug in git-cola's library version checking code, or if it's invoking some other python version that doesn't have the needed libs, making this a missing dependency bug.

Change History (7)

comment:1 Changed 11 months ago by reneeotten (Renee Otten)

Owner: set to raimue
Port: git-cola added
Status: newassigned

sorry for the trouble... I did update the port to its current version earlier in the year and verified that it worked. Just installed it again now and I don't see any issues. It seems to me that the Python ports you have installed (py311-pyqt5 and py311-qtpy) should indeed suffice.

The only thing I can think of is that you perhaps have the QT_API environment variable set? That is what is used by QtPy to figure out what backend to use (if not set, it will use Qt5); so if you have it set to something else than PyQt5 the failure is likely because you don't have these Python bindings installed.

>>> port notes py311-qtpy
--->  py311-qtpy has the following notes:
  QtPy needs one of the following backends to be installed on your system: PyQt5, PyQt6,
  PySide2, or PySide6. If multiple backends are available, PyQt5 will be used unless you
  set the QT_API environment variable.

comment:2 Changed 11 months ago by odysseus9672 (Sean Lake)

I don't have QT_API set.

Seans-Work-Macbook-Pro:~ sean$ echo $QT_API

Seans-Work-Macbook-Pro:~ sean$ git-cola

You do not seem to have PyQt (or PySide) and qtpy installed.
Please install the PyQt (or PySide) and qtpy into your Python environment.

For example, on a Debian/Ubuntu system you can install these using apt:

    sudo apt install python3-pyqt5 python3-pyqt5.qtwebkit python3-qtpy


I tried to install qt5-qtwebkit, thinking that might help, but it didn't.

If you can tell me where in the source code to find where this error message comes from, I can do a better job of nailing down exactly what's going wrong.

comment:3 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)

Try running these commands... do you get an error?

python3.11
from PyQt5 import QtGui
from qtpy import QtGui

Then you can press Control-D to exit the python interpreter.

comment:4 in reply to:  2 Changed 11 months ago by reneeotten (Renee Otten)

Replying to odysseus9672:

If you can tell me where in the source code to find where this error message comes from, I can do a better job of nailing down exactly what's going wrong.

You can just grep the source and find where it is: /opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cola/app.py

comment:5 Changed 11 months ago by reneeotten (Renee Otten)

also, looking again now we already patch the files such that the environment variable is set to Qt5. So in short, I am not sure this should work for you as well...

comment:6 Changed 11 months ago by odysseus9672 (Sean Lake)

Looks like your suggestion has found the problem. When doing the imports suggested I get:

Seans-Work-Macbook-Pro:~ sean$ python3.11
Python 3.11.4 (main, Jun 10 2023, 10:30:46) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtGui
>>> from qtpy import QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/qtpy/__init__.py", line 57, in <module>
    from packaging.version import parse
ModuleNotFoundError: No module named 'packaging'
>>> 

I installed py311-packaging, and the imports now work, and git-cola now launches. So, qtpy is missing a dependency. I don't know if this affects all of the versions of qtpy, but someone should probably check.

comment:7 Changed 11 months ago by reneeotten (Renee Otten)

Resolution: fixed
Status: assignedclosed

In c6990b02abac9c7b49b6049360edf93c1651dbc3/macports-ports (master):

py-qtpy: add missing dependency

Closes: #67694

Note: See TracTickets for help on using tickets.