-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PermissionError: [WinError 5] Access is denied #236
Comments
Hey @zariiii9003, thanks for reporting. It seems this is caused because at some point you ran Spyder as admin and now it's not possible for it to install some fonts it needs as a non-admin user. Can you confirm that? |
No, that's the first time i installed it on that device. But i just noticed another thing that might be relevant: the device runs on Windows Server 2016 Version 1607 |
Ok, that could be the issue. This new feature is available for recent versions of Windows 10. However, we'll try to check if QtAwesome is compatible the Windows in which it's installed before trying to install its fonts. |
@CAM-Gerlach, you mentioned that you also found this issue in the computer of a person you were trying to help, right? |
Thanks for the ping—Yup, this was the same issue. Even though the font file was present in that directory but not actually installed on the system, I was also completely unable to delete it manually even after restarting and also running a special tool to delete files on restart to avoid them being "in use". This was on a nearly brand new user account that the user had just created, though she had installed and then uninstalled Anaconda previous to installing Spyder standalone (but the machine had been restarted in between). I was going to have IT take a look with admin permissions, but the next day she reported she had fixed it by installing an older version of Spyder (AFAIK, prior to you making the change to fix the font not loading issue I previously reported on another user's machine here), uninstalling that, and then re-installing the latest version. I can't check now, but I believe that machine was still running Windows 10 Enterprise 1903. For what it's worth, here's the full traceback on Spyder launch: Full tracebackTraceback (most recent call last):
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\app\start.py", line 257, in main
mainwindow.main(options, args)
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\app\mainwindow.py", line 1823, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\app\utils.py", line 289, in create_window
main.setup()
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\app\mainwindow.py", line 732, in setup
internal_plugins = find_internal_plugins()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\app\find_plugins.py", line 40, in find_internal_plugins
mod = importlib.import_module(entry_point.module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\plugins\pylint\plugin.py", line 22, in <module>
from spyder.plugins.pylint.confpage import PylintConfigPage
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\plugins\pylint\confpage.py", line 16, in <module>
from spyder.plugins.pylint.main_widget import (MAX_HISTORY_ENTRIES,
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\plugins\pylint\main_widget.py", line 90, in <module>
class CategoryItem(QTreeWidgetItem):
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\plugins\pylint\main_widget.py", line 102, in CategoryItem
'icon': ima.icon("convention")
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\spyder\utils\icon_manager.py", line 434, in icon
qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json',
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\qtawesome\__init__.py", line 280, in load_font
return _instance().load_font(prefix, ttf_filename, charmap_filename, directory)
^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\qtawesome\__init__.py", line 130, in _instance
_resource['iconic'] = IconicFont(*_BUNDLED_FONTS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\qtawesome\iconic_font.py", line 338, in __init__
self.load_font(*fargs)
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\qtawesome\iconic_font.py", line 374, in load_font
directory = self._get_fonts_directory()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\qtawesome\iconic_font.py", line 593, in _get_fonts_directory
fonts_directory = self._install_fonts(fonts_directory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kcarmer\AppData\Local\miniforge3\envs\spyderenv\Lib\site-packages\qtawesome\iconic_font.py", line 629, in _install_fonts
os.remove(dst_path)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\kcarmer\\AppData\\Local\\Microsoft\\Windows\\Fonts\\materialdesignicons5-webfont.ttf' |
According to the QtAwesome code, this situation happens when we're unable to install our fonts for the current user: qtawesome/qtawesome/iconic_font.py Lines 628 to 631 in dc2dfbe
So, we could catch the error generated by One option is to catch the The other option is to stop using QtAwesome in Spyder, extract all icons that we're grabbing from Material Design and add them to Spyder as SVGs. However, I think that's way too much work for our small team. @dalthviz, @CAM-Gerlach, what do you think?
Could you check again, if possible? This feature was introduced on Windows 10 1803, according to MS docs. |
If it was introduced in 1803 and reliably works for everything above that, then while not ideal, it doesn't seem that unreasonable to drop support for Windows versions below that for Spyder 6, since at least by the time it is released later this year, the Windows versions below that will all be EoL for some time, except for Server 2016 (and 1507 and 1607 LTSC, which are very unlikely to have major version desktop software updates anyway). However, we should be sure that it is working reliably first and this issue is resolved.
Yeah, it definitely shouldn't be older than that version, but I asked the user to double check and will let you know what I hear. Unfortunately, I can't seem to repro it on my Windows machine to be able to test myself, nor can I actually repro now on that machine after she installed the older Spyder version first then installed the newer version. |
I think we should catch the error caused by |
Yeah, that's a good idea too, i.e. we could raise Since I like it better than my original suggestion, I think we should go with it instead. |
Note: This could be happening due to the file being used by the system or some other process so the font is already loaded/being used (maybe we are not properly detecting that with the |
That's a very good point. In that case, we should pass in the try/except around |
This is slightly different, but related. I was running qtawesome on two different Python installations (one with qtawesome 1.2.3 and one with qtawesome 1.3.0) (actually, one was a Python app that was packaged to an exe with PyInstaller) and I got a PermissionError on shutil.copy, a few lines above the os.remove. For me, this only happened when one was running and I started the other one, since one version was using the font and the other was trying to update it. I updated the one instance from version 1.2.3 to version 1.3.0 and the problem went away (because the codicon.ttf files were the same), but I suspect it would still be an issue anytime the font files get updated in qtawesome. For me, it means that I can't run PyInstaller apps that have different versions of qtawesome at the same time, e.g. one that was built with the latest qtawesome and one that was built last week. Traceback on qtawesome 1.3.0:
|
Hello, I'm running Windows 10 and installed miniconda. I opened the anaconda prompt and used this:
Which causes the error below and spyder fails to open
|
Hey, just to chime back in. I restarted my system and the problem resolved. I do still get this error |
I had the same issue on a win 11 machine, one environment with python 3.8, spyder 5.4 loaded spyder without error. Two other environments (python 3.9/spyder 5.4, python 3.10/ spyder 5.5 wouldn't load because of the codicon.ttf error. But now they load after a system restart. Then I started the 3.8/5.4 environment again and it wouldn't load. Just reporting this for your information. Restarting as mentioned by @maximus-sci fixes the issue and is an acceptable solution for me. Thank you for Spyder! |
i had same issue in version 1.3.0 always access denied when i uninstall and install lower version 1.2.3 its working on python 3.10 (win10) |
I found the same error |
Same issue here. Restarting doesn't help. Looks like I could only open spyder in the first env, the second env it will gives error of permission denied codicon.tff |
Same as @jlitster-freeus here, but in my case the two installations had the same qtawesome version (1.3.0). However, qtawesome in the one packaged with PyInstaller was installed with pip and the one in the other installation, a conda environment, was installed from anaconda (conda-forge). I reinstalled qtawesome with pip, and the conflict seems to be resolved. Maybe qtawesome 1.3.0 in anaconda has a different charmap from the pip package? |
I have the same. I have a application that i compile with pyinstaller. Some Windows 2022 (Version: 21h2) Terminalservers copies it to a local folder, and RDP-Terminalusers run it from there. Sometimes when a user starts the app he gets:
When i go to that folder i can't manual delete the file, cause it's blocked by "system". Edit: I also happens with 1.2.3, so it's Independent from the qtawesome version. It has to do something with windows versions/changes. |
Can confirm that signing in and out of windows fixes the Errno 13 problem. Very strange. |
Hey folks, we'll release a new version soon (1.3.1) to try to fix this problem. Hopefully that will solve it for you. |
I installed spyder in a fresh environment, but qtawesome raises an exception on spyder startup. Please take a look at the traceback.
Why does it try to delete files that it does not own?
It calls
os.remove('C:\\Users\\USERNAME\\AppData\\Local\\Microsoft\\Windows\\Fonts\\codicon.ttf')
Traceback
Package List
The text was updated successfully, but these errors were encountered: