From 3247947d7dee4a545365e5261b3d7999df1b2d64 Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:58:48 -0800 Subject: [PATCH 1/2] Always activate a conda environment. --- spyder/plugins/ipythonconsole/utils/kernelspec.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spyder/plugins/ipythonconsole/utils/kernelspec.py b/spyder/plugins/ipythonconsole/utils/kernelspec.py index 5141015bfd6..b9105538e8d 100644 --- a/spyder/plugins/ipythonconsole/utils/kernelspec.py +++ b/spyder/plugins/ipythonconsole/utils/kernelspec.py @@ -92,11 +92,8 @@ def argv(self): self.set_conf('default', True, section='main_interpreter') self.set_conf('custom', False, section='main_interpreter') - # Part of spyder-ide/spyder#11819 - is_different = is_different_interpreter(pyexec) - # Command used to start kernels - if is_different and is_conda_env(pyexec=pyexec): + if is_conda_env(pyexec=pyexec): # If this is a conda environment we need to call an intermediate # activation script to correctly activate the spyder-kernel From c645a9e91a69160a28f39ca6e778bbf0784aad69 Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:49:16 -0800 Subject: [PATCH 2/2] Remove obsolete is_different_interpreter function --- spyder/plugins/ipythonconsole/utils/kernelspec.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spyder/plugins/ipythonconsole/utils/kernelspec.py b/spyder/plugins/ipythonconsole/utils/kernelspec.py index b9105538e8d..a3588255539 100644 --- a/spyder/plugins/ipythonconsole/utils/kernelspec.py +++ b/spyder/plugins/ipythonconsole/utils/kernelspec.py @@ -12,7 +12,6 @@ import logging import os import os.path as osp -import sys # Third party imports from jupyter_client.kernelspec import KernelSpec @@ -32,13 +31,6 @@ logger = logging.getLogger(__name__) -def is_different_interpreter(pyexec): - """Check that pyexec is a different interpreter from sys.executable.""" - executable_validation = osp.basename(pyexec).startswith('python') - directory_validation = osp.dirname(pyexec) != osp.dirname(sys.executable) - return directory_validation and executable_validation - - def get_activation_script(quote=False): """ Return path for bash/batch conda activation script to run spyder-kernels.