You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeError: QStackedWidget parent unexpected type 'QMainWindow' #82
I believe that I had this problem as well. I think that uninstalling PyQt5 and reinstalling PyQt6 solved it? Please tell me if that doesn't work, but I think it has something to do with accidentally using PyQt5 when PyQt6 is installed (program checks if PyQt6 is installed, not if it is being used primarily).
I cannot easily do that, as it breaks dependencies I have from other installed packages. Is there some way I can force it (make sure) to use PyQt6 when running this?
Perhaps try a virtual environment? That way you can run an array of packages that are separate from your universal ones.
If you have python3-venv, just run python3 -m venv venv (from OS to OS, the exact commands may vary).
Perhaps try a virtual environment? That way you can run an array of packages that are separate from your universal ones. If you have python3-venv, just run python3 -m venv venv (from OS to OS, the exact commands may vary).
When trying a virtual environment with the following packages installed via pip: pyqt6, qtpy, requests, qtwidgets, pyside2, pypresence
I get this output:
Traceback (most recent call last):
File "/opt/NSO-RPC/app.py", line 736, in <module>
window.setupUi(MainWindow)
File "/opt/NSO-RPC/layout/qt6_layout.py", line 16, in setupUi
self.stackedWidget = QtWidgets.QStackedWidget(parent=MainWindow)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: QStackedWidget(parent: typing.Optional[QWidget] = None): argument 'parent' has unexpected type 'PySide2.QtWidgets.QMainWindow'
If I change that from pyqt6 to pyqt5 it appears to work however, so it seems pyqt6 is the bad package, not pyqt5.
So I guess the end goal is to either make the script use PyQt6 compatible code, or figure out how to force it to use the desired version and not just the latest installed version (probably a Python default?).
While it's nice to have a workaround, I don't really want to have to use a venv every time I run this 😅.
Perhaps try a virtual environment? That way you can run an array of packages that are separate from your universal ones. If you have python3-venv, just run python3 -m venv venv (from OS to OS, the exact commands may vary).
When trying a virtual environment with the following packages installed via pip: pyqt6, qtpy, requests, qtwidgets, pyside2, pypresence I get this output:
Traceback (most recent call last):
File "/opt/NSO-RPC/app.py", line 736, in <module>
window.setupUi(MainWindow)
File "/opt/NSO-RPC/layout/qt6_layout.py", line 16, in setupUi
self.stackedWidget = QtWidgets.QStackedWidget(parent=MainWindow)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: QStackedWidget(parent: typing.Optional[QWidget] = None): argument 'parent' has unexpected type 'PySide2.QtWidgets.QMainWindow'
If I change that from pyqt6 to pyqt5 it appears to work however, so it seems pyqt6 is the bad package, not pyqt5.
So I guess the end goal is to either make the script use PyQt6 compatible code, or figure out how to force it to use the desired version and not just the latest installed version (probably a Python default?).
While it's nice to have a workaround, I don't really want to have to use a venv every time I run this 😅.
You shouldn't have pyside2 installed ,that package was never tested or accounted for. doubt its an issue though, you also shouldn't need to use a venv.
The step that I'm confused about is that the linux install script installed python3-pyqt6 here, in your case, if you already have python3-pyqt5 installed, it should naturally fallback onto python3-pyqt5.
If you have both installed, try doing the following instead QT_API="pyqt5" /opt/NSO-RPC/app.py and see if it successfully loads that way.
Update about this issue, Another user on the discord encountered this error and we were able diagnose it to being an issue with client/layout/init.py
Specifically their was an edgecase where both Qt5 and Qt6 are installed, however when trying to fallback to Qt5, it'd still continue to try and load Qt5 layout with Qt6.
This would either cause it trying to load PySide2, Giving the user something like TypeError: QStackedWidget(parent: typing.Optional[QWidget] = None): argument 'parent' has unexpected type 'PySide2.QtWidgets.QMainWindow''
or attempting to load Qt6's layout with Qt5, Giving the following error TypeError: QStackedWidget(parent: typing.Optional[QWidget] = None): argument 'parent' has unexpected type 'QMainWindow'
I've already made a replacement that gets around this issue, and it should be coming to NSO-RPC's development branch and merged into main after some other small bugs are worked out first.
You shouldn't have pyside2 installed ,that package was never tested or accounted for. doubt its an issue though, you also shouldn't need to use a venv.
Everything I installed in the venv was just based on running the script and every time it failed to run for a missing dependency I installed it. And I did have to use the venv since I can't uninstall pyqt5 or pyqt6 ;)
You shouldn't have pyside2 installed ,that package was never tested or accounted for. doubt its an issue though, you also shouldn't need to use a venv.
Everything I installed in the venv was just based on running the script and every time it failed to run for a missing dependency I installed it. And I did have to use the venv since I can't uninstall pyqt5 or pyqt6 ;)
If you want a quick fix without waiting, Apply this commit by editing client/layout/__init__.py and replace it. HotaruBlaze@574c6a9
This should fix NSO-RPC and make it load correctly.
Activity
MCMi460 commentedon Jun 8, 2023
I believe that I had this problem as well. I think that uninstalling PyQt5 and reinstalling PyQt6 solved it? Please tell me if that doesn't work, but I think it has something to do with accidentally using PyQt5 when PyQt6 is installed (program checks if PyQt6 is installed, not if it is being used primarily).
Magicrafter13 commentedon Jun 9, 2023
I cannot easily do that, as it breaks dependencies I have from other installed packages. Is there some way I can force it (make sure) to use PyQt6 when running this?
MCMi460 commentedon Jun 9, 2023
Perhaps try a virtual environment? That way you can run an array of packages that are separate from your universal ones.
If you have
python3-venv, just runpython3 -m venv venv(from OS to OS, the exact commands may vary).HotaruBlaze commentedon Jun 9, 2023
Hi, I've only now saw this, if you do
pip install pyqt5it should fix this.pyqt6 is installed by default but u can have both pyqt5 and pyqt6 installed by default, and it should default do pyqt5 if both are installed.
You can also do
pip uninstall pyqt6if your system isn't pyqt6 compatibleNote: qtpy will try and use pyqt5 by default, then attempts to use pyqt6 afterwards
HotaruBlaze commentedon Jun 9, 2023
You can override what package qtpy tries to use with the following: https://github.com/spyder-ide/qtpy#requirements
Magicrafter13 commentedon Jun 9, 2023
I already have both pyqt5 and pyqt6 installed, but via my package manager, not pip.
Magicrafter13 commentedon Jun 9, 2023
When trying a virtual environment with the following packages installed via pip:
pyqt6,qtpy,requests,qtwidgets,pyside2,pypresenceI get this output:
If I change that from pyqt6 to pyqt5 it appears to work however, so it seems pyqt6 is the bad package, not pyqt5.
So I guess the end goal is to either make the script use PyQt6 compatible code, or figure out how to force it to use the desired version and not just the latest installed version (probably a Python default?).
While it's nice to have a workaround, I don't really want to have to use a venv every time I run this 😅.
HotaruBlaze commentedon Jun 9, 2023
You shouldn't have pyside2 installed ,that package was never tested or accounted for. doubt its an issue though, you also shouldn't need to use a venv.
The step that I'm confused about is that the linux install script installed python3-pyqt6 here, in your case, if you already have
python3-pyqt5installed, it should naturally fallback onto python3-pyqt5.If you have both installed, try doing the following instead
QT_API="pyqt5" /opt/NSO-RPC/app.pyand see if it successfully loads that way.HotaruBlaze commentedon Jun 23, 2023
Update about this issue, Another user on the discord encountered this error and we were able diagnose it to being an issue with client/layout/init.py
Specifically their was an edgecase where both Qt5 and Qt6 are installed, however when trying to fallback to Qt5, it'd still continue to try and load Qt5 layout with Qt6.
This would either cause it trying to load PySide2, Giving the user something like
TypeError: QStackedWidget(parent: typing.Optional[QWidget] = None): argument 'parent' has unexpected type 'PySide2.QtWidgets.QMainWindow''or attempting to load Qt6's layout with Qt5, Giving the following error
TypeError: QStackedWidget(parent: typing.Optional[QWidget] = None): argument 'parent' has unexpected type 'QMainWindow'I've already made a replacement that gets around this issue, and it should be coming to NSO-RPC's development branch and merged into main after some other small bugs are worked out first.
Magicrafter13 commentedon Jun 24, 2023
Everything I installed in the venv was just based on running the script and every time it failed to run for a missing dependency I installed it. And I did have to use the venv since I can't uninstall pyqt5 or pyqt6 ;)
HotaruBlaze commentedon Jun 24, 2023
If you want a quick fix without waiting, Apply this commit by editing
client/layout/__init__.pyand replace it.HotaruBlaze@574c6a9
This should fix NSO-RPC and make it load correctly.
MCMi460 commentedon Jul 3, 2023
This should now be fixed, as of #87.
Thanks for bringing our attention to this!