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: Always activate a conda environment for IPython consoles #21783

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions spyder/plugins/ipythonconsole/utils/kernelspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import logging
import os
import os.path as osp
import sys

# Third party imports
from jupyter_client.kernelspec import KernelSpec
Expand All @@ -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.
Expand Down Expand Up @@ -92,11 +84,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)
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved

# 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

Expand Down
Loading