Reputation: 114219
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:
It appears that some of the layout data is not being saved correctly.
Upvotes: 2
Views: 1519
Reputation: 572
On my Ubuntu 20.04 LTS system, at least some of the window layout settings are stored in the file ~/.config/spyder-py3/config/transient.ini
. Under the section [quick_layouts]
there are some relevant variables.
I've experienced a similar issue with Spyder versions 5.2.2 and 5.3.0, installed via conda
from the conda-forge
channel in environments using only conda-forge
packages. I did not use sudo
or pip
in the installation. See also this github issue.
In addition to changes made to the window layout not being remembered at a subsequent start up, the predefined window layout options (RStudio, Matlab, Vertical split, Horizontal split) and my previously manually defined layouts are not available from the View
-> Window layouts
menu. The layout preferences
option is greyed out and neither the Use next layout
or Use previous layout
options do anything. I think I've found a work-around for this, though.
I noted that after opening a new Spyder 5.3.0 window the following variables in the [quick_layouts]
section of the transient.ini
file are set equal to empty lists: names
, order
, active
, and ui_names
. This does not happen when using Spyder versions 5.1.5 or 5.1.1, where the lists contain strings of names of layout options. The empty lists appear to be the cause of the behaviour described, as the panes can be temporarily restored by pasting the old list values from a back up file into the current transient.ini
file. As a work-around, when in a Spyder v5.3.0 window, select Save current layout
from View
-> Window layouts
and close Spyder. Subsequently, your window layout should be remembered when opening a new Spyder instance.
Upvotes: 1
Reputation: 708
When installing spyder (via pip) it looks like it adds configuration files for the user at /home/<user>/.config/spyder-py3/
I imagine with the sudo pip3
install, the configuration is stored in a folder that requires root permission for writing. So that's possibly why the configuration isn't being saved.
Update: For me (installed without sudo
), what appears to be the layout configuration is saved in:
/home/<user>/.config/spyder-py3/config/transient.ini
You might be able to search your filesystem for that and check permissions.
Upvotes: 0
Reputation: 3190
Installing the package via sudo pip3 ...
is probably the reason for these issues. Perhaps try creating a virtual environment and installing spyder with the environment active?
I am on a Windows machine at the moment so double checking an actual Linux install is not possible at the moment. Nevertheless, here are some places to check:
spyder
spyder-py3
spyder-py3-dev
The configuration folders are set to be relative to your home directory. Configuration files are also possibly stored in:
'/etc/spyder'
'/usr/local/etc/spyder'
And if you are using Anaconda, it will make tracking down the folder a little trickier as Spyder may include configuration files relative to the environment variable CONDA_PREFIX
.
If none of those locations contain what you are looking for, check the Spyder source code for the file spider.config.base and see where it is attempting to read/write a configuration file.
Upvotes: 0