Run the 2 lines of code.
import pandas as pd
data = [['tom', 10], ['nick', 15], ['juli', 14]]
df = pd.DataFrame(data, columns = ['Name', 'Age'])
Then using Variable explorer try to "remove" both lines.
One line removes and the other does not.
Then try to remove the one that is still displaying.
It is pretty consistent.
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 790, in contextMenuEvent
self.refresh_menu()
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 707, in refresh_menu
self.refresh_plot_entries(index)
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 712, in refresh_plot_entries
is_list = self.is_list(key)
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 1464, in is_list
return self.var_properties[name]['is_list']
KeyError: 'df'
Traceback (most recent call last):
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 790, in contextMenuEvent
self.refresh_menu()
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 707, in refresh_menu
self.refresh_plot_entries(index)
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 712, in refresh_plot_entries
is_list = self.is_list(key)
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 1464, in is_list
return self.var_properties[name]['is_list']
KeyError: 'df'
Traceback (most recent call last):
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 790, in contextMenuEvent
self.refresh_menu()
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 707, in refresh_menu
self.refresh_plot_entries(index)
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 712, in refresh_plot_entries
is_list = self.is_list(key)
File "C:\Users\jmonroe1\AppData\Roaming\Python\Python37\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 1464, in is_list
return self.var_properties[name]['is_list']
KeyError: 'df'
atomicwrites >=1.2.0 : 1.3.0 (OK)
chardet >=2.0.0 : 3.0.4 (OK)
cloudpickle >=0.5.0 : 1.2.2 (OK)
diff_match_patch >=20181111 : 20181111 (OK)
intervaltree : None (OK)
IPython >=4.0 : 7.8.0 (OK)
jedi =0.14.1 : 0.14.1 (OK)
nbconvert >=4.0 : 5.6.0 (OK)
numpydoc >=0.6.0 : 0.9.1 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=0.3 : 5.6.3 (OK)
pygments >=2.0 : 2.4.2 (OK)
pylint >=0.25 : 2.4.2 (OK)
pyls >=0.31.2;<0.32.0 : 0.31.7 (OK)
zmq >=17 : 18.1.0 (OK)
qdarkstyle >=2.7 : 2.8 (OK)
qtawesome >=0.5.7 : 0.6.0 (OK)
qtconsole >=4.6.0 : 4.6.0 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.8.3 (OK)
sphinx >=0.6.6 : 2.2.0 (OK)
spyder_kernels >=1.8.1;<2.0.0: 1.8.1 (OK)
watchdog : None (OK)
cython >=0.21 : 0.29.13 (OK)
matplotlib >=2.0.0 : 3.1.1 (OK)
numpy >=1.7 : 1.16.5 (OK)
pandas >=0.13.1 : 0.25.1 (OK)
scipy >=0.17.0 : 1.3.1 (OK)
sympy >=0.7.3 : 1.4 (OK)
I finally could reproduce this, but for the second time: please do not open a new issue about this in case the error appears for you in the future. It's just a waste of time for me because I have to look for your older issue and close it.
I still don't know how to fix it though.
@dalthviz, I managed to reproduce this when the kernel takes more than usual to start, in my case because I open Chrome before opening Spyder, and my system doesn't have enough free RAM for that, so it uses some swap to start the kernel instead (I think).
Then, you need to open df, leave it open, go back to the Variable Explorer and press the button to remove all variables. After that you'll see that df remains in the Variable Explorer and when you do a right click on it to delete it, the error reported by @moonrox will be shown.
This could be what's causing bug #11001 too, but I'm not sure.
After some testing, seems like this is related (as well as #11001) with the 'proxy model' not updating properly after removing variables. So, even when the variables are actually removed, some of them could still be available through the variable explorer, causing a KeyError if trying to do some action over them.