Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Fix showing Spyder-kernels message on kernel restarts (IPython console) #20233

Merged
merged 2 commits into from
Dec 21, 2022

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Dec 20, 2022

Description of Changes

  • This was failing because I incorrectly set a check that should only work in our tests, so I removed it.
  • Improve test that checks this so that it works for all operating systems.
  • Fix test_conda_env_activation, which started to fail due to this fix and it was not working correctly.
  • Improve a bit the message we show when the kernel can't be interrupted.

Issue(s) Resolved

Fixes #20023

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: @ccordoba12

@ccordoba12 ccordoba12 merged commit eac428f into spyder-ide:5.x Dec 21, 2022
@ccordoba12 ccordoba12 deleted the issue-20023 branch December 21, 2022 20:51
ccordoba12 added a commit that referenced this pull request Dec 21, 2022
@anuragsodhi
Copy link

I am still facing this issue with spyder 5.4.1. I have spyder kernels 2.4.1 installed in other python env. What is strange is if i open anaconda prompt active the python env containing spyder (and latest 3.11 python) and run spyder from there, change python env containing python 3.7, i dont get any error, but when i run spyder from windows shortcut, i get this error upon switching to python 3.7 env (which has 2.4.1 kernel)

Traceback (most recent call last):
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\spyder\plugins\ipythonconsole\widgets\main_widget.py", line 2136, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle,
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 30, in wrapped
raise e
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 27, in wrapped
return loop.run_until_complete(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\nest_asyncio.py", line 90, in run_until_complete
return f.result()
^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\tasks.py", line 267, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 90, in wrapper
raise e
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 82, in wrapper
out = await method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 391, in _async_start_kernel
kernel_cmd, kw = await ensure_async(self.pre_start_kernel(**kw))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 30, in wrapped
raise e
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 27, in wrapped
return loop.run_until_complete(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\nest_asyncio.py", line 90, in run_until_complete
return f.result()
^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\tasks.py", line 267, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 356, in _async_pre_start_kernel
kw = await self.provisioner.pre_launch(**kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\provisioning\local_provisioner.py", line 193, in pre_launch
kernel_cmd = km.format_kernel_cmd(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 265, in format_kernel_cmd
cmd = self.kernel_spec.argv + extra_arguments
^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\spyder\plugins\ipythonconsole\utils\kernelspec.py", line 107, in argv
get_conda_activation_script(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\spyder\utils\conda.py", line 76, in get_conda_activation_script
if osp.basename(exe).startswith('micromamba'):
^^^^^^^^^^^^^^^^^
File "", line 242, in basename
File "", line 211, in split
TypeError: expected str, bytes or os.PathLike object, not NoneType

@ccordoba12
Copy link
Member Author

@anuragsodhi, please open a new issue about your problem so we can track it there. This pull request is not related to it nor it tried to fix it.

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

Successfully merging this pull request may close these issues.

2 participants