(FIXED) Spyder Error at command prompt is ‘QWidget :must construct QApplication before Qwidget’
Today I was trying to launch Spyder from my Anaconda only to continue getting the error message:
QWidget :must construct QApplication before Qwidget
I searched online for solutions but got no useful link. Some solutions suggested to “pip install spyder” then pip update spyder”. I tried them but still the error persisted.
Then I came across another suggestion that warned against using pip to install or update a package in conda environment. According to this article from the official anaconda blog, anaconda may deliberately neglect the latest version of some packages for compatibility reasons. So, do NOT use pip to update conda packages. Read the hyperlinked article for the correct way to update anaconda packages.
Now, back to the topic. How to correct “QWidget :must construct QApplication before Qwidget” in Ananconda.
Step 1: Launch the Anaconda Navigator
Step 2: Select the environment of your choice
Step 3: Uninstall Spyder
Step 4: Reinstall Spyder and update if available
Step 5: Uninstall PyQT
Step 6: Reinstall PyQT and update if available
Step 7: Run Spyder and Enjoy