Skip to content

Conversation

@mrclary
Copy link
Contributor

@mrclary mrclary commented Jul 31, 2025

Description of Changes

When the selected Python interpreter environment does not have a compatible spyder-kernels version installed, offer to install it.
If the user rejects the installation, then the conventional error is displayed.
If the user accepts the installation, then spyder-kernels is installed into the environment from the same channel as the environment Python.
Upon successful completion, the kernel is automatically connected.

Issue(s) Resolved

Fixes #22855

spyk-install

@mrclary mrclary marked this pull request as ready for review December 24, 2025 06:56
@dalthviz
Copy link
Member

dalthviz commented Jan 5, 2026

Checked this locally on Windows and for the conda case seems like things are working 👍

Also some notes from my check:

  • Noticed that you could potencially accept installing spyder-kernels from multiple consoles and sometimes you can briefly see a loading widget alongside the actual console widget (not sure if having multiple consoles installing could be the cause of that behavior 🤔):
image
  • Seems like if you have multiple consoles before spyder-kernels is installed (even when an installation was accepted) you can potencially close all the consoles or create new ones which you will need to end up closing manually to be able to detect that spyder-kernels was installed:

spyder_kernels_install

@mrclary
Copy link
Contributor Author

mrclary commented Jan 6, 2026

Checked this locally on Windows and for the conda case seems like things are working 👍

Thanks for checking on this, @dalthviz.

  • Noticed that you could potencially accept installing spyder-kernels from multiple consoles

I assume that you mean multiple consoles connected to the same kernel or using the same environment. I'm not sure what to do about that. Since this is being handled by the client, multiple clients using the same environment could independently offer to install spyder-kernels. Maybe some kind of check could be run through the main widget that would prevent multiple offerings on the same environment?

and sometimes you can briefly see a loading widget alongside the actual console widget (not sure if having multiple consoles installing could be the cause of that behavior 🤔):

I don't think this has anything to do with multiple consoles. I'm glad that you saw this. I think I saw this as well, but not sure how it's happening, since each individual widget (shellwidget, infowidget, and installwidget) is supposed to be hidden before a particular widget is made visible. Hmm...

  • Seems like if you have multiple consoles before spyder-kernels is installed (even when an installation was accepted) you can potencially close all the consoles or create new ones which you will need to end up closing manually to be able to detect that spyder-kernels was installed:

I see. Let's talk about the desired UX with the group and see what we can do about it.

@CAM-Gerlach
Copy link
Member

UI wise, the message looks rather different from the other messages we show in the console, in terms of layout, background, text, etc, where it looks more like regular console content than the other pane messages we show (errors, empty pane messages, help pane empty message, etc). Maybe for a followup PR for Carlos/Andres to work on, but perhaps some low hanging fruit fixes would be practical in this PR, e.g. centering the text and perhaps adding a border like the other error/informational messages.

Also, to be clearer that clicking the "OK" button will actually execute the install on their environment rather than merely just accepting that the environment is outdated, you might want to rename it "Install". Or, perhaps to further clarify what the other option is and that it isn't just giving up, the options could be "Install automatically" and "Install manually"?

I assume that you mean multiple consoles connected to the same kernel or using the same environment. I'm not sure what to do about that. Since this is being handled by the client, multiple clients using the same environment could independently offer to install spyder-kernels. Maybe some kind of check could be run through the main widget that would prevent multiple offerings on the same environment?

It does seem to me that this scenario isn't that likely in practice for actual users, since they are going to get the message on the first console they start in that environment and presumably going to decide to either accept and let it finish or dismiss it before opening another one in the same environment, expecting different results. However, it does seem worth at least making sure that unexpected behavior doesn't result if the user requests multiple installations, e.g. by disabling the "OK" button or not offering the installation if the user opens another console, though it would be better to show a dedicated message that an install is in progress and ideally auto-restart the console when it completes.

@mrclary mrclary force-pushed the spy-kernel-install branch from 5ec659a to 18e709c Compare January 22, 2026 23:33
…environment does not have the appropriate spyder-kernels version.
kernel_spec.argv will no longer reset the configuration to the default interpreter if spyder-kernels version is not satisfied in the custom interpreter. Rather a SpyderKernelVersionError is raised to branch the code execution to potentially install spyder-kernels.
Adding infowidget to layout in refresh_container is redundant and results in infowidget placed below installwidget.
…ling spyder-kernels.

Note that setIconVisibleInMenu(False) at SpyderAction instantiation results in the environment menu item not reflecting its enabled state in the menubar. Removing this, or setting it to True (QAction defaults to True), produces the correct behavior. Also note that menubar items still do not show the icon for macOS (as desired) because setIconVisibleInMenu is called in set_menu_icons.
kernel_spec.argv will no longer reset the configuration to the default interpreter if spyder-kernels version is not satisfied in the custom interpreter. Rather a SpyderKernelVersionError is raised to branch the code execution to potentially install spyder-kernels."

This reverts commit dde7a42.
@mrclary mrclary force-pushed the spy-kernel-install branch from 68cfcc0 to e182791 Compare January 29, 2026 05:11
@mrclary
Copy link
Contributor Author

mrclary commented Jan 30, 2026

I don't know why the tests are taking so long and result in being cancelled. The failing tests pass locally on my Windows machine 🤷🏼 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion: option to auto-install spyder-kernels

4 participants