Spyder won't open

N
Nicholas Tiveron (1670 points)
2 5 8
asked Dec 22, 2020 in Programming in Python by Nicholas Tiveron (1,670 points)
Hello everybody!

I have this really frustrating problem with Spyder (I'm using Windows) that I can't seem to solve by any means: in short, when I click on the Spyder application (or try to run it in any other way, namely the Anaconda prompt, Win + R, etc.), it doesn't launch (the arrow displays the blue loading circle for a brief moment but then nothing happens).

Here's a list of things I have tried (some of them I found on the internet posted by people with the same problem); obviously, none of these worked and the problem still persists:

- restarting my laptop / checking for updates,

- trying to update Anaconda, Spyder and Jupyter,

- resetting Spyder and trying the following command for issues with pyqt5: conda install qt=5.6* pyqt=5.6* sip=4.18*,

- uninstalling Spyder and re-installing it,

- deleting the spyder.lock file in the .spyder2 folder,

- uninstalling Anaconda altogether (and manually deleting all related folders that remain after the automatic process) and installing it again.

One detail that may be important is that Anaconda Prompt and Jupyter seem to work fine (as I mentioned I was able to check for updates and execute other commands in Anaconda Prompt), whereas Spyder and the Anaconda Navigator (which should open a web page to the users' manual of Anaconda) won't open when I try to run them. Also, all of this happened only because I tried to install the pytest library since I couldn't find it anymore in Spyder; before opening it today, everything worked (including pytest to run tests directly in Spyder).

Of course, I believe you know why getting my Spyder to work again would be crucial, especially since I have to work on a few homework recoveries.

Any help would be much appreciated, since I spent all of today trying to fix this.

Thanks and happy holidays!
3,028 views

2 Answers

Best answer
S
Silktrader (2550 points)
1 6 16
answered Dec 22, 2020 by Silktrader (2,550 points)
selected Dec 23, 2020 by Nicholas Tiveron

We should create isolate "virtual environments" in Anaconda (and "pip") to avoid tinkering with the "base" one. I have a few; one is devoted to homework related packages and I'd rather not touch it. In the future you could experiment with that feature to ward against undesired updates, changes.

As for your issue, Windows logs might shed some insight. Run Spyder from an Anaconda prompt, by typing its name, watch it hang. Search for "Event Viewer" in the Start menu, then select "Windows Logs", then "Application" and look for "Errors" and their description. You can then Google the reported exception code and module (likely "python38.dll"). Don't get your hopes high but there might be existing resolved bug reports. Given that you also have issues with Navigator it may be a QT related problem, possibly with PySide (Python's QT bindings).

I remember Anaconda being a pain in the ''.join(('a', 's'*2)) while removing it. There's a package one needs to install, which cleans up caches, lock files, tarballs, etc. — it must be run before uninstalling the whole shebang. Check out  anaconda-clean. Best of luck!

N
Nicholas Tiveron (1670 points)
2 5 8
commented Dec 22, 2020 by Nicholas Tiveron (1,670 points)
First off, thank you for your insightful response.

Secondly, I might try virtual environments in the future, given the experience I'm having now.

Regarding your suggestion, I Googled the error code but wasn't very lucky. What I found out from my search, however, is that it appears that the problem is common to other apps as well, to provide a few examples: one had issues with the game Warframe, a French person had this error on "Farbar Recovery Scan Tool" because of a firewall problem (I already tried whitelisting all Python apps) and finally a guy on a Chinese forum got this error when running Qampp (from what I gathered, it's the Chinese version of Xampp, which, honestly, I had no idea what it was up to now). As expected when dealing with obscure errors, in most forums there was no answer, reply or solution provided and most of the people that solved the issue did it with a simple re-installation.

I also tried anaconda-clean, with little success. The only ray of hope is that you were right in identifying the cause of the problem since it appears to be PySide, specifically, the lack thereof, as I get different errors like " ModuleNotFoundError: No module named 'PySide' " or " PythonQtError: No Qt bindings could be found " (if you or anyone else feels that looking at any error code in full would be helpful, just let me know, I didn't include them simply because sometimes an explanation is better than a copy-paste of a bunch of random numbers and letters).

Additionally, in my deep scouring of the Internet, I actually found a post on this Q2A from 2 years ago and apart from all the things I have already tried, one person said that when they had a similar problem they solved it by uninstalling Anaconda and installing Python (and from there manually installing Spyder and all the other needed libraries from the prompt). Is this something worth attempting? Of course, by now I am willing to do anything to get Spyder to work properly again, however, I just wanted to wait awhile before having to potentially repeat the whole process of uninstalling-installing yet another time.

Any input is very much appreciated.
N
Nicholas Tiveron (1670 points)
2 5 8
commented Dec 22, 2020 by Nicholas Tiveron (1,670 points)
As it turns out, sometimes full error codes are better. Here is what I get when trying to run Spyder from the Anaconda Prompt:
"
Traceback (most recent call last):
  File "C:\Users\Nicholas\anaconda3\lib\site-packages\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 "C:\Users\Nicholas\anaconda3\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Nicholas\anaconda3\lib\site-packages\spyder\app\start.py", line 208, in main
    from spyder.app import mainwindow
  File "C:\Users\Nicholas\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 53, in <module>
    requirements.check_qt()
  File "C:\Users\Nicholas\anaconda3\lib\site-packages\spyder\requirements.py", line 41, in check_qt
    import qtpy
  File "C:\Users\Nicholas\anaconda3\lib\site-packages\qtpy\__init__.py", line 210, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
"
and this is the report from Event Viewer, Event 8198, Security-SPP (the same error that shows up in the Windows Logs every time I tried to run Spyder):
"
License Activation (slui.exe) failed with the following error code:
hr=0x8007000D
Command-line arguments:
RuleId=502ff3ba-669a-4674-bbb1-601f34a3b968;Action=AutoActivateSilent;AppId=55c92734-d682-4d71-983e-d6ec3f16059f;SkuId=2de67392-b7a7-462a-b1ca-108dd189f588;NotificationInterval=1440;Trigger=NetworkAvailable
"

Thanks again.
S
Silktrader (2550 points)
1 6 16
commented Dec 22, 2020 by Silktrader (2,550 points)

That narrows things down. Try to reinstall the QT packages, from Anaconda's prompt (which should select the proper channel):

conda install qt --force-reinstall
conda install pyqt --force-reinstall
conda install qtpy --force-reinstall

You will probably be prompted to install a gazillion dependencies. Don't use "pip" to install packages.

I doubt the "license activation" error is related to Anaconda's woes.

Anaconda allows you to revert to previous "revisions". I've never done so myself but I occasionally consult:

conda list --revisions

... that will show the latest, dated, changes applied to your setup.

N
Nicholas Tiveron (1670 points)
2 5 8
commented Dec 22, 2020 by Nicholas Tiveron (1,670 points)
I executed all those commands and then checked the revisions. With today's date are marked all those three commands (obviously) and anaconda-clean. Before that there's only something from yesterday (which is still later than when the problem emerged) and November the 13th (which is a month too early and consequently probably not the cause of these errors). Should I try to revert to that revision? If I try to run Spyder from Anaconda again, I get the same error as before, even though all the forced reinstallations were completed.
N
Nicholas Tiveron (1670 points)
2 5 8
commented Dec 23, 2020 by Nicholas Tiveron (1,670 points)

Huge thanks to @Silktrader for helping me solve this issue. I will briefly describe here how I am finally able to open Spyder again and what I found to be the cause of this mess (in hopes that this could help someone else in the future).

To solve the problem, I deleted the folder ".spyder-py3" from "C:\Users\Nicholas" and "Python" from "C:\Users\Nicholas\AppData\Roaming" (yes, I had tried deleting both of these before but never at the same time). That's it. After doing this, Spyder worked normally.

As for the cause of all my troubles, it turns out it was actually that initial download: in fact, when I said I downloaded the pytest library, I found out I did it using pip instead of conda in the Anaconda prompt (I knew it shouldn't be done, I just forgot). 

TL;DR: always remember to NEVER mix up pip and conda installations

I
IliyasAlimzhan (180 points)
0 0 2
answered Dec 22, 2020 by IliyasAlimzhan (180 points)
I suggest you uninstall spyder and delete its cache which is located in the AppData/Local folder. You could also do this with anaconda just in case its cache is located in AppData/Roaming.
I
IliyasAlimzhan (180 points)
0 0 2
commented Dec 22, 2020 by IliyasAlimzhan (180 points)
These folders could be hidden in your user folder. You can access them via windows + R or unhide them up to you. There is also a .spyder-py3 folder in your user folder, you can delete that too if it doesnt go away after uninstalling

.
N
Nicholas Tiveron (1670 points)
2 5 8
commented Dec 22, 2020 by Nicholas Tiveron (1,670 points)
I tried to do as you said but after installing Spyder again, I have the same problem as before. Thanks for the tip anyway.