spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.14k stars 1.58k forks source link

Spyder unable to load Spyder 3 icon theme, same issue as #18642 #21458

Closed vmahe1 closed 9 months ago

vmahe1 commented 10 months ago

Issue Report Checklist

Problem Description

I just installed spyder through anaconda, it was working fine for a few minutes, until I updated MiKTeX (TeX distribution to write LaTeX documents). After that, I got the exact same issue as the one described in #18642, which I recall below:

Spyder refuses to load the icon theme of Spyder 3 and falls back to the icon theme of Spyder 2, which is no longer adapted (many spyder icons are replaced by red crosses). Selecting theme 3 can be done in tools -> preferences -> appearance -> main interface, but it then asks to restart spyder to apply the changes, and when restarting Spyder keeps refusing to load them 3.

What steps reproduce the problem?

  1. Open spyder
  2. Go to tools -> preferences -> appearance -> main interface and select Spyder 3 in "icon theme"
  3. Restart spyder and see the error message "Spyder was unable to load the Spyder 3 icon theme. That's why it's going to fallback to the theme used in Spyder 2. For that, please close this window and start Spyder again"

What is the expected output? What do you see instead?

The expected behaviour is Spyder 3 to work properly as this issue is indicated as "closed" in #18642

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0                             :  1.4.0 (OK)
chardet >=2.0.0                                  :  4.0.0 (OK)
cloudpickle >=0.5.0                              :  2.2.1 (OK)
cookiecutter >=1.6.0                             :  1.7.3 (OK)
diff_match_patch >=20181111                      :  20200713 (OK)
intervaltree >=3.0.2                             :  3.1.0 (OK)
IPython >=7.31.1,<9.0.0,!=8.8.0,!=8.9.0,!=8.10.0 :  8.15.0 (OK)
jedi >=0.17.2,<0.19.0                            :  0.18.1 (OK)
jellyfish >=0.7                                  :  1.0.1 (OK)
jsonschema >=3.2.0                               :  4.17.3 (OK)
keyring >=17.0.0                                 :  23.13.1 (OK)
nbconvert >=4.0                                  :  6.5.4 (OK)
numpydoc >=0.6.0                                 :  1.5.0 (OK)
paramiko >=2.4.0                                 :  2.8.1 (OK)
parso >=0.7.0,<0.9.0                             :  0.8.3 (OK)
pexpect >=4.4.0                                  :  4.8.0 (OK)
pickleshare >=0.4                                :  0.7.5 (OK)
psutil >=5.3                                     :  5.9.0 (OK)
pygments >=2.0                                   :  2.15.1 (OK)
pylint >=2.5.0,<3.0                              :  2.16.2 (OK)
pylint_venv >=2.1.1                              :  2.3.0 (OK)
pyls_spyder >=0.4.0                              :  0.4.0 (OK)
pylsp >=1.7.2,<1.8.0                             :  1.7.2 (OK)
pylsp_black >=1.2.0                              :  1.2.1 (OK)
qdarkstyle >=3.0.2,<3.2.0                        :  3.0.2 (OK)
qstylizer >=0.2.2                                :  0.2.2 (OK)
qtawesome >=1.2.1                                :  1.2.3 (OK)
qtconsole >=5.4.2,<5.5.0                         :  5.4.2 (OK)
qtpy >=2.1.0                                     :  2.2.0 (OK)
rtree >=0.9.7                                    :  1.0.1 (OK)
setuptools >=49.6.0                              :  68.0.0 (OK)
sphinx >=0.6.6                                   :  5.0.2 (OK)
spyder_kernels >=2.4.3,<2.5.0                    :  2.4.4 (OK)
textdistance >=4.2.0                             :  4.2.1 (OK)
three_merge >=0.1.1                              :  0.1.1 (OK)
watchdog >=0.10.3                                :  2.1.6 (OK)
zmq >=22.1.0                                     :  23.2.0 (OK)

# Optional:
cython >=0.21                                    :  None (NOK)
matplotlib >=3.0.0                               :  3.7.2 (OK)
numpy >=1.7                                      :  1.24.3 (OK)
pandas >=1.1.1                                   :  2.1.1 (OK)
scipy >=0.17.0                                   :  1.11.3 (OK)
sympy >=0.7.3                                    :  1.11.1 (OK)
ccordoba12 commented 10 months ago

Hey @vmahe1, thanks for reporting. Please open the Anaconda Prompt and run there

qta-browser

That should give you an error, which is fine. Please copy it and paste it here.

murtazaak101 commented 10 months ago

@ccordoba12 I am also facing the exact same issue as the original poster of this post. When I run the qta-browser as you mentioned, I get the following error:

Traceback (most recent call last): File "C:\Users\murtaza.khan\AppData\Local\anaconda3\Scripts\qta-browser-script.py", line 10, in sys.exit(run()) File "C:\Users\murtaza.khan\AppData\Local\anaconda3\lib\site-packages\qtawesome\icon_browser.py", line 270, in run browser = IconBrowser() File "C:\Users\murtaza.khan\AppData\Local\anaconda3\lib\site-packages\qtawesome\icon_browser.py", line 28, in init qtawesome._instance() File "C:\Users\murtaza.khan\AppData\Local\anaconda3\lib\site-packages\qtawesome__init__.py", line 130, in _instance _resource['iconic'] = IconicFont(_BUNDLED_FONTS) File "C:\Users\murtaza.khan\AppData\Local\anaconda3\lib\site-packages\qtawesome\iconic_font.py", line 338, in init self.load_font(fargs) File "C:\Users\murtaza.khan\AppData\Local\anaconda3\lib\site-packages\qtawesome\iconic_font.py", line 390, in load_font raise FontError(u"Font at '{0}' appears to be empty. " qtawesome.iconic_font.FontError: Font at 'C:\Users\murtaza.khan\AppData\Local\Microsoft\Windows\Fonts\fontawesome4.7-webfont.ttf' appears to be empty. If you are on Windows 10, please read https://support.microsoft.com/en-us/kb/3053676 to know how to prevent Windows from blocking the fonts that come with QtAwesome.

ccordoba12 commented 10 months ago

@murtazaak101, what's your Windows version?

murtazaak101 commented 10 months ago

@ccordoba12 It is Windows 10 Enterprise. I figured the turnaround actually. In the error it mentions "please read https://support.microsoft.com/en-us/kb/3053676 to know how to prevent Windows from blocking the fonts that come with QtAwesome." In the link inside I followed the instructions and disabled the blocking of fonts, restarted my PC and now it works like a charm again.

vmahe1 commented 10 months ago

Thanks for the quick reply @ccordoba12! I clicked the link and followed the instructions as well, but I'm not sure how to change the value of the key ''MitigationOptions" in the registry editor (never did such a thing before and a bit afraid of messing thing up). Here is a screenshot of what I see. To disable the blocking of fonts, should I simply type "2000000000000" where my cursor is (right before the first pair of zeros)? unstrusted fonts issue

murtazaak101 commented 10 months ago

@vmahe1 In the link there is another way as well which is much simpler. It is by accessing Local Group Policy Editor. You can do that by pressing Windows key + R to open the 'Run' command then type gpsedit.msc and run it. image

vmahe1 commented 10 months ago

Thanks for the tip, I changed "Blocking of untrusted font (blocage de police non approuvée in French)" from "not configured" to "deactivated" and restarted my computed twice, but I still have the error.

I would prefer not to modify the "MitigationOptions" as it is not clear how to modify it, so I am still stuck with Spyder 2 icon theme... Maybe a work around would be to copy the spyder fonts in the C:\Windows\Fonts directory, but I did not find where the spyder fonts are.

unstrusted fonts issue2

GitKia1392 commented 10 months ago

No if you can OPEN Spyder then open it and right click on "Completions: internal" then click "Change environment preferences in Settings" --> [down below choose the Spyder 2 icon and see if that works and notify me.] Spydericon

vmahe1 commented 9 months ago

Hi @GitKia1392, I clicked "Completions: conda" (see screenshot below), then clicked "Change default environment in Preferences..." and arrived in the "Python interpreter" tab of the "Preferences" panel. I am not sure that is what you meant, but in "Preferences"->"Appearance"->"Icon theme" I already have "Spyder 2" selected (see below), and that is precisely my problem. If I were able to select "Spyder 3" and restart Spyder properly, then I guess I wouldn't have icons replaced by red crosses. untrusted fonts issue 3 untrusted fonts issue 4

murtazaak101 commented 9 months ago

@vmahe1 In the Local Group Policy editor, follow the instructions as before and then keep these settings, they worked for me

image

vmahe1 commented 9 months ago

@murtazaak101 I tried selecting "enable" and the option "do not block untrusted fonts", restarted my computer, but the issue persists.

ccordoba12 commented 9 months ago

@murtazaak101, another way to solve this problem is to take the fonts distributed with QtAwesome (the package we rely on for our icons) and install them in your system:

https://github.com/spyder-ide/qtawesome/tree/master/qtawesome/fonts

Don't worry about the json files present there, just download all ttf files and install them as described here:

https://support.microsoft.com/en-us/office/add-a-font-b7c5f17c-4426-4b53-967f-455339c564c1

GitKia1392 commented 9 months ago

Aright @vmahe1 So try these: Goto Anaconda Prompt via Search --> enter this: conda create -n spyder-env spyder -y conda activate spyder-env spyder restart spyder 2nd solution is to do this: Create a file named SpyErr.bat --> open it with Notepad --> paste this python -c 'import sys; print(sys.executable)' --> then open cmd.exe as an administrator --> Type SpyErr.bat then it should give you the error thaat spyder is facing --> Tell if either work.

Thanks

vmahe1 commented 9 months ago

@ccordoba12 I tried installing the fonts as suggested, they are now in My Windows/Fonts directory, often with "Normal" appended to the font's name (see below). I restarted my computer, but I still have the same issue. untrusted fonts issue 7

@GitKia1392 I tried both suggestions. For the 1st one I had an error when running the whole line (see below). I ran conda create -n spyder-env, pressed y, then conda activate spyder-env. I restarted spyder but still have the error. untrusted fonts issue 5 Then I tried the other one but I got the error "python can't be found" (see below in french in the consol) untrusted fonts issue 6

ccordoba12 commented 9 months ago

@vmahe1, please open the Anaconda Prompt and run

spyder --reset

Then try again. Hopefully that should fix your problem.

vmahe1 commented 9 months ago

@ccordoba12 I did the reset and restarted my computer, but still no change, I still have the issue.

ccordoba12 commented 9 months ago

Sorry to hear that. I really don't know why the fonts are not picked up by Spyder and I'm out of ideas.

vmahe1 commented 9 months ago

Ok, thank you very much for the help anyway.

ccordoba12 commented 9 months ago

Hope you can find a way to solve this problem. For now I'm going to close this issue because there's nothing else we can do for you.