ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 222 forks source link

spyder crashes with RuntimeError: Invalid Qt API 'PyQt5', valid values are: 'pyside', 'pyqt', 'pyqt5' #1408

Open athompson673 opened 7 years ago

athompson673 commented 7 years ago

On a fresh install of anaconda I had several issues with starting spyder. the first was to fix qt.conf as mentioned here. then I got the error mentioned in the title... I took a look at qtconsole\qt.py which threw the error based on the basis that os.environ.get('QT_API', None) did not match any of the options given in qtconsole\qt_loaders.py. as the error stated "PyQt5" did not match it's hardcoded "pyqt5". Changing qtconsole\qt_loaders.py fixed the issue for me, but as I see it, this could also be changed by altering whatever sets QT_API (I did not look for where that happens)

full traceback:

Traceback (most recent call last):
  File "C:\Users\usrname\AppData\Local\Continuum\Anaconda3\lib\site-packages\sp
yder\app\mainwindow.py", line 2989, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\usrname\AppData\Local\Continuum\Anaconda3\lib\site-packages\sp
yder\app\mainwindow.py", line 2893, in run_spyder
    main.setup()
  File "C:\Users\usrname\AppData\Local\Continuum\Anaconda3\lib\site-packages\sp
yder\app\mainwindow.py", line 872, in setup
    from spyder.plugins.ipythonconsole import IPythonConsole
  File "C:\Users\usrname\AppData\Local\Continuum\Anaconda3\lib\site-packages\sp
yder\plugins\ipythonconsole.py", line 28, in <module>
    from qtconsole.client import QtKernelClient
  File "C:\Users\usrname\AppData\Local\Continuum\Anaconda3\lib\site-packages\qt
console\client.py", line 14, in <module>
    from qtconsole.qt import QtCore
  File "C:\Users\usrname\AppData\Local\Continuum\Anaconda3\lib\site-packages\qt
console\qt.py", line 17, in <module>
    (QT_API, QT_API_PYSIDE, QT_API_PYQT, QT_API_PYQT5))
RuntimeError: Invalid Qt API 'PyQt5', valid values are: 'pyside', 'pyqt', 'pyqt5'
athompson673 commented 7 years ago

Update it would be better to change QT_API as now I'm having an issue with sitecustomize.py* (part of spyder) also expecting a hardcoded: "pyqt5" where is this env. var. set?

mingwandroid commented 7 years ago

The likely problem here is that your install location contains more than 30 characters. We need to fix this. Thanks for reporting.

athompson673 commented 7 years ago

It's just the default install for single user... my username is only 8 chars long. I set the env. var. to "pyqt5" through the windows dialogue, and it now works.

mingwandroid commented 7 years ago

This:

C:\Users\usrname\AppData\Local\Continuum\Anaconda3 is not 8 chars long, I understand that it is the default location, it is a bug that we need to fix. You should not need to set QT_API.