Spyder ide 5.5.2 not running files

Hello I am having trouble with spyder ide 5.5.2 not running files. This started suddenly without warning. I tried restart the kernel, ran the files through Configuration per file, uninstalling and reinstalling, but nothing has work. Can anyone give me advice on how to fix this. (e.x. code opens a GUI, but doesn’t open anymore due to spyder)

In additional restarting spyder and now I get this error

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 8.12.3 -- An enhanced Interactive Python.

=========================================================================
NOTE: The following error appeared when setting your Matplotlib backend!!
=========================================================================

Traceback (most recent call last):
File "C:\Program Files\Spyder\pkgs\spyder_kernels\console\kernel.py", line 750, in _set_mpl_backend
	get_ipython().run_line_magic(magic, backend)
File "C:\Program Files\Spyder\pkgs\IPython\core\interactiveshell.py", line 2417, in run_line_magic
    result = fn(*args, **kwargs)
File "C:\Program Files\Spyder\pkgs\IPython\core\magics\pylab.py", line 99, in matplotlib
    gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
File "C:\Program Files\Spyder\pkgs\IPython\core\interactiveshell.py", line 3588, in enable_matplotlib
    from matplotlib_inline.backend_inline import configure_inline_support
File "C:\Program Files\Spyder\pkgs\matplotlib_inline\__init__.py", line 1, in <module>
    from . import backend_inline, config  # noqa
File "C:\Program Files\Spyder\pkgs\matplotlib_inline\backend_inline.py", line 8, in <module>
    from matplotlib.backends import backend_agg
File "C:\Program Files\Spyder\pkgs\matplotlib\backends\backend_agg.py", line 32, in <module>
	from matplotlib.backend_bases import (
File "C:\Program Files\Spyder\pkgs\matplotlib\backend_bases.py", line 45, in <module>
    from matplotlib import (
File "C:\Program Files\Spyder\pkgs\matplotlib\text.py", line 16, in <module>
    from .font_manager import FontProperties
File "C:\Program Files\Spyder\pkgs\matplotlib\font_manager.py", line 1551, in <module>
   fontManager = _load_fontmanager()
File "C:\Program Files\Spyder\pkgs\matplotlib\font_manager.py", line 1546, in _load_fontmanager
    json_dump(fm, fm_path)
File "C:\Program Files\Spyder\pkgs\matplotlib\font_manager.py", line 958, in json_dump
    with cbook._lock_path(filename), open(filename, 'w') as fh:
File "contextlib.py", line 113, in __enter__
File "C:\Program Files\Spyder\pkgs\matplotlib\cbook\__init__.py", line 1819, in _lock_path
	raise TimeoutError("""\
TimeoutError: Lock error: Matplotlib failed to acquire the following lock file:
    C:\Users\tnu20\.matplotlib\fontlist-v330.json.matplotlib-lock
This maybe due to another process holding this lock file.  If you are sure no
other Matplotlib process is running, remove this file and try again.


Hello,

as a sanity check, can you try running your script with IDLE.

Update:
Glad you got it working!

That probably didn’t do what you expected, tkinter cannot be installed from pypi, it is either provided by your OS (for example linux distro packages) or shipped with python itself (for example the windows installer). The package tk on pypi is not tkinter, it is apparently short for “TensorKit” tk · PyPI.

The error was about some file lock, which I guess would have been solved automatically after a while even if you didn’t do this.

2 Likes

Huh, I wonder what caused the file lock? I don’t remember doing anything immediately before hand that could trigger this.

1 Like

Looks like it was created by matplotlib, so could be any script that was using matplotlib, maybe another instance of Spyder itself (though I think Spyder prevents opening multiple instances by default).

None of my py file explicitly use matplotlib so I have no idea on that front. And this problem still occurred when after I shut down my PC when all instances of Spyder closed