I installed spyder via sudo pip3 install spyder on both Ubuntu and Arch, since the pacakage-managed version was not as recent as I'd like. The only issue I've noticed so far is that my pane layout is not being saved. For example: I close my variable explorer and plot windows, but they come back up next time I open the application.
I strongly suspect it's a permissions issue with the configuration file, but I don't know where that file lives. In the interests of avoiding an X-Y problem, I've posted the background material, but my main question is, where does spyder store its window and pane layouts?
I ran spyder --reset from the command line and got the following output:
*** Reset Spyder settings to defaults ***
removing: /home/madphysicist/.config/spyder-py3/help
removing: /home/madphysicist/.config/spyder-py3/onlinehelp
removing: /home/madphysicist/.config/spyder-py3/spyder.ini
removing: /home/madphysicist/.config/spyder-py3/temp.py
removing: /home/madphysicist/.config/spyder-py3/template.py
removing: /home/madphysicist/.config/spyder-py3/history.py
removing: /home/madphysicist/.config/spyder-py3/history_internal.py
removing: /home/madphysicist/.config/spyder-py3/workingdir
removing: /home/madphysicist/.config/spyder-py3/.ropeproject
removing: /home/madphysicist/.config/spyder-py3/langconfig
removing: /home/madphysicist/.config/spyder-py3/spyder.lock
removing: /home/madphysicist/.config/spyder-py3/config/spyder.ini
removing: /home/madphysicist/.config/spyder-py3/config/transient.ini
removing: /home/madphysicist/.config/spyder-py3/plugins
The directory /home/madphysicist/.config/spyder-py3/ is owned by madphysicist, as are all its contents.
When I run spyder --debug verbose (minimal does not anything), I see a line that pops up when editing the layout:
2022-03-22 13:09:19,767 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (8): 127.0.0.1:46624
The last couple of lines of the log, regarding shutdown, may offer a hint, as it looks like something possibly related to this issue failed as the session was closing down:
2022-03-22 13:10:04,661 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that internal_console is going to be turned off
2022-03-22 13:10:04,662 [DEBUG] [spyder.api.widgets.main_widget] -> Docking plugin back to the main window
2022-03-22 13:10:04,662 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that statusbar is going to be turned off
2022-03-22 13:10:04,662 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that shortcuts is going to be turned off
2022-03-22 13:10:04,662 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that appearance is going to be turned off
2022-03-22 13:10:04,662 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that explorer is going to be turned off
2022-03-22 13:10:04,663 [DEBUG] [spyder.api.widgets.main_widget] -> Docking plugin back to the main window
2022-03-22 13:10:04,663 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that outline_explorer is going to be turned off
2022-03-22 13:10:04,663 [DEBUG] [spyder.api.widgets.main_widget] -> Docking plugin back to the main window
2022-03-22 13:10:04,666 [DEBUG] [spyder.api.plugin_registration.registry] -> Disconnecting layout from layout
2022-03-22 13:10:04,667 [DEBUG] [spyder.api.plugin_registration.registry] -> Notifying plugin layout that layout is going to be turned off
2022-03-22 13:10:04,730 [DEBUG] [traitlets] -> shutdown: {}
2022-03-22 13:10:04,730 [DEBUG] [traitlets] -> stream: {'name': 'stderr', 'text': 'Exception in thread Thread-4:\nTraceback (most recent call last):\n File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner\n self.run()\n File "/usr/lib/python3.6/threading.py", line 864, in run\n self._target(*self._args, **self._kwargs)\n File "/usr/local/lib/python3.6/dist-packages/spyder_kernels/comms/frontendcomm.py", line 124, in poll_thread\n self.poll_one()\n File "/usr/local/lib/python3.6/dist-packages/spyder_kernels/comms/frontendcomm.py", line 144, in poll_one\n self._comm_close(msg)\n File "/usr/local/lib/python3.6/dist-packages/spyder_kernels/comms/frontendcomm.py", line 241, in _comm_close\n self.close(comm_id)\n File "/usr/local/lib/python3.6/dist-packages/spyder_kernels/comms/frontendcomm.py", line 104, in close\n return super(FrontendComm, self).close(comm_id)\n File "/usr/local/lib/python3.6/dist-packages/spyder_kernels/comms/commbase.py", line 173, in close\n self._comms[comm_id][\'comm\'].close()\nKeyError: \'1c5154b8aa0b11eca3b16c946661f1ca\'\n\n'}
2022-03-22 13:10:04,732 [DEBUG] [spyder.plugins.ipythonconsole.comms.kernelcomm] -> Dropping interrupt because comm is disconnected: {'call_name': 'set_namespace_view_settings', 'call_id': 'd49cbdd2291142ed8ff80e500890025b', 'settings': {'interrupt': True, 'blocking': False, 'timeout': None, 'display_error': False, 'send_reply': False}}
Update
The same issue happens when I install spyder locally in a venv. First I make sure that it is not installed anywhere on my system with pip or apt. Then I run the following:
$ sudo apt install python3-venv
$ mkdir -p ~/.venv
$ python3 -m venv ~/.venv/spyder-test
$ source ~/.venv/spyder-test/bin/activate
$ pip install spyder
$ echo '[Desktop Entry]
Version=1.0
Type=Application
Name=Spyder
GenericName=Spyder
Comment=Scientific PYthon Development EnviRonment - Python3
Icon=/home/madphysicist/.venv/spyder-test/share/icons/spyder.png
TryExec=/home/madphysicist/.venv/spyder-test/bin/spyder
Exec=/home/madphysicist/.venv/spyder-test/bin/spyder %F
Categories=Development;Science;IDE;Qt;
Terminal=false
StartupNotify=true
MimeType=text/x-python;' > ~/.local/share/applications/spyder.desktop
$ update-desktop-database ~/.local/share/applications
This installs spyder and creates an icon for it in the application menu. I am able to start spyder just fine through the icon or through the command line. Any attempt to reopen resets some, but not all of the window layout. The basic pane layout changes. However, the following two items appear to be reset:
- "Check for updates on startup" check box in the "New Spyder Version" dialog
- The Help pane does not close. If I move it around, its layout is saved correctly. However, the pane is always on when I restart spyder, even when I close it through the bar or through the View->Panes menu.
It appears that some of the layout data is not being saved correctly.