rdwr3r
(Rdwr3r)
September 26, 2023, 1:13am
1
I haven’t been able to find anything recent on this issue (I.e. since ~2021), which makes me think it was solved but somehow I missed it.
I am trying to call filedialog.askdirectory() (with filedialog imported from tkinter) within the Spyder IDE on Mac OS X (Ventura 13.6).
This worked fine on my Windows machine, but now crashes python anytime I try to run the code that has this call in it. I have tried creating different environments with different versions of Python (specifically Python 3.9.18 and 3.10.13, which are the only lower versions than 3.11.4 available on Anaconda Navigator), and they all behave the same.
A screenshot of the failure is below.
MRAB
(Matthew Barnett)
September 26, 2023, 1:44am
2
It sounds like you’re having this issue:
opened 12:53AM - 31 Dec 21 UTC
closed 04:06AM - 17 Jan 22 UTC
status:Awaiting Followup
### Issue Report Checklist
* [x] Searched the [issues page](https://github.co… m/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [x] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
* [x] Restarted Spyder
* [x] Reset preferences with ``spyder --reset``
* [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
* [x] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below
## Problem Description
To reproduce this:
1. Start with a clean Spyder install
2. Go to Preferences -> IPython Console -> Graphics and set "Backend" to anything except "Inline." Let's say Qt5.
3. At this point, close the entire program and restart it, so that it starts up with Qt5 as the backend when loading the first kernel.
4. Type `import tkinter; tkinter.Tk()`
You then get the following message
```
____________________________________________________________
Restarting kernel...
```
and the kernel restarts.
This doesn't seem to happen if you have "Inline" set, for whatever reason, and it also doesn't happen if you have "Inline" set and then change it without restarting the kernel, so it's recommended to try the above method to reproduce it.
I searched for issues involving Tkinter but this seems different. For instance, in #17061 we have an error which causes a traceback. There are many similar issues with the same traceback. But, in this situation, there is no traceback, just this "Restarting kernel..." message. I tried the solution that spyder-bot suggested in #17061, which was to `conda install jupyter_client=6.1.12 freetype=2.10.4`, but it made no difference.
## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->
Python 3.9.7 64-bit | Qt 5.9.7 | PyQt5 5.9.2 | Darwin 17.7.0
on MacOS High Sierra 10.13.6
### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->
```
# Mandatory:
applaunchservices >=0.1.7 : 0.2.1 (OK)
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 4.0.0 (OK)
cloudpickle >=0.5.0 : 2.0.0 (OK)
cookiecutter >=1.6.0 : 1.7.2 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree >=3.0.2 : 3.1.0 (OK)
IPython >=7.6.0 : 7.29.0 (OK)
jedi >=0.17.2;<0.19.0 : 0.18.0 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
keyring >=17.0.0 : 23.4.0 (OK)
nbconvert >=4.0 : 6.1.0 (OK)
numpydoc >=0.6.0 : 1.1.0 (OK)
parso >=0.7.0;<0.9.0 : 0.8.2 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.8.0 (OK)
pygments >=2.0 : 2.10.0 (OK)
pylint >=2.5.0;<2.10.0 : 2.9.6 (OK)
pyls_spyder >=0.4.0 : 0.4.0 (OK)
pylsp >=1.2.2;<1.3.0 : 1.2.4 (OK)
pylsp_black >=1.0.0 : None (OK)
qdarkstyle =3.0.2 : 3.0.2 (OK)
qstylizer >=0.1.10 : 0.1.10 (OK)
qtawesome >=1.0.2 : 1.0.3 (OK)
qtconsole >=5.1.0 : 5.1.1 (OK)
qtpy >=1.5.0 : 1.10.0 (OK)
rtree >=0.9.7 : 0.9.7 (OK)
setuptools >=49.6.0 : 58.0.4 (OK)
sphinx >=0.6.6 : 4.2.0 (OK)
spyder_kernels >=2.1.1;<2.2.0 : 2.1.3 (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 >=17 : 22.3.0 (OK)
# Optional:
cython >=0.21 : 0.29.25 (OK)
matplotlib >=2.0.0 : 3.4.3 (OK)
numpy >=1.7 : 1.21.2 (OK)
pandas >=1.1.1 : 1.3.4 (OK)
scipy >=0.17.0 : 1.7.1 (OK)
sympy >=0.7.3 : 1.9 (OK)
```
The suggested solution is to go to Preferences → IPython Console → Graphics and set “Backend” to “Inline”.
Good luck!
rdwr3r
(Rdwr3r)
September 26, 2023, 1:59am
3
Oh, great advice. Thank you.
Confirmed that setting the backend graphics utility to “inline” that the Kernel no longer crashes.
Interestingly, I changed the backend to “Tkinter” after this and it worked exactly ONCE, and then started crashing the Kernel again.
Carlos’s comment on the thread you linked noted that the issues with TKinter were supposed to be resolved within a week, and his post was dated January 2022.
I’m wondering if there’s either still an issue here I haven’t resolved? It would be really really nice not to have to use inline graphics.