Choosing and Configuring the Python Interpreter in Spyder
A decision guide for choosing and configuring the Python interpreter in Spyder: compare conda, venv, and system Python; understand spyder-kernels version locking; and verify the active environment with concrete commands.
29 Sept 2026, 02:47 UTC

The Decision: Which Interpreter Runs Your Code
Spyder ships with its own bundled Python interpreter that runs the IDE itself. This internal interpreter is not meant for your project code. The first practical decision every Spyder user faces is pointing the IDE at a separate environment—conda, venv, or a system Python—where your packages actually live. Get this wrong and you'll install packages into Spyder's internals, break the IDE, or spend hours debugging why import numpy fails despite a successful pip install.
Supported Options at a Glance
| Option | How It Works | Best For | Key Constraint |
|---|---|---|---|
| Conda environment | Create env with conda create -n myenv python=3.11, install spyder-kernels inside it, point Spyder to its python executable |
Projects needing compiled libraries (GDAL, PyTorch, optimized BLAS, GIS stacks) | Requires conda/mamba installed; larger disk footprint |
| Virtual environment (venv) | Create with python -m venv .venv, activate, pip install spyder-kernels, point Spyder to .venv/bin/python (or .venv\Scripts\python.exe) |
Pure-Python projects, lightweight workflows, CI parity | No non-Python dependency management; you handle system libraries yourself |
| Existing system / user Python | Install spyder-kernels into the target interpreter (pip install spyder-kernels or conda install spyder-kernels), set its path in Preferences |
Quick experiments, single-user machines with one well-maintained Python | Pollutes the interpreter with kernel packages; version conflicts likely over time |
| Spyder's bundled interpreter (not recommended) | Default if you change nothing; runs code in the IDE's own runtime | Nothing—avoid for project work | Installing packages here can break Spyder updates and UI |
Trade-offs That Matter in Practice
Conda vs. venv: The Binary Dependency Line
If your requirements.txt or environment.yml pulls packages with C extensions—numpy, pandas, scipy, rasterio, torch—conda's precompiled binaries and non-Python library management (MKL, GDAL, PROJ, CUDA) save hours of pip install failures. For pure-Python stacks (Django, FastAPI, requests, pytest), venv is faster to create, smaller on disk, and matches what most CI runners use.
spyder-kernels Version Lock
Spyder communicates with the kernel process via the spyder-kernels package installed in the target environment. The version must fall within the range your Spyder release expects. A mismatch produces a console connection error at startup. Spyder logs the required range in its startup dialog (Help → About → Dependencies) and in the console output when a kernel fails to launch. Treat spyder-kernels as part of Spyder's runtime, not your project dependencies—pin it per environment, upgrade it when you upgrade Spyder.
Windows Path Gotchas
Interpreter paths containing spaces (C:\Program Files\Python311\python.exe) or non-ASCII characters have historically caused kernel launch failures. If you hit "kernel died" immediately on Windows, move the environment to a simple path (C:\envs\myenv) or use the 8.3 short name.
Concrete Setup: Pointing Spyder at a Conda Environment
- Create the environment (run in your shell, not Spyder):
conda create -n spyder-project python=3.11 conda activate spyder-project conda install spyder-kernels # pulls version compatible with current Spyder release - Get the interpreter path:
conda run -n spyder-project python -c "import sys; print(sys.executable)"# Example output: # /home/user/miniconda3/envs/spyder-project/bin/python # C:\Users\name\miniconda3\envs\spyder-project\python.exe - Configure Spyder: Open Preferences → Python interpreter, select "Use the following Python interpreter", paste the path from step 2. Click Apply.
- Restart the kernel: Consoles → Restart kernel or open a new console (Consoles → New console). The change does not take effect until the kernel process restarts.
- Verify in the new console:
The printed executable must match the conda environment path, not Spyder's install directory. Theimport sys print(sys.executable) import spyder_kernels print(spyder_kernels.__version__)spyder_kernelsversion should fall within the range shown in Spyder's startup dialog.
Concrete Setup: Pointing Spyder at a venv
- Create and populate:
python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -U pip pip install spyder-kernels # plus your project packages - Get the interpreter path:
.venv/bin/python -c "import sys; print(sys.executable)" - Configure and verify using steps 3–5 above.
Validation Checklist After Any Interpreter Change
- New console shows the expected
sys.executablepath. import spyder_kernels; print(spyder_kernels.__version__)reports a version inside Spyder's supported range.- A package installed only in the new environment (e.g.,
pip install requestsin that env) imports successfully in the console. - No "kernel died" or connection error appears in the Consoles pane.
Common Failure Modes and Quick Fixes
| Symptom | Likely Cause | Fix |
|---|---|---|
| Console opens but shows Spyder's internal python path | Kernel not restarted after changing Preferences | Consoles → Restart kernel or open a new console |
| "Kernel died" immediately on launch | spyder-kernels version mismatch or missing | Install matching spyder-kernels in target env; check Spyder's startup dialog for required range |
| ImportError for package you just installed | Installed into wrong environment (often Spyder's bundled one) | Activate target env, reinstall package there, restart kernel |
| Windows: kernel fails with path error | Spaces/non-ASCII in interpreter path | Recreate env at simple path (e.g., C:\envs\proj) |
Limitations
- Spyder can only run one kernel per console tab; each tab uses the single interpreter set in Preferences. For per-project interpreters, either change the setting per project or run separate Spyder instances.
- The
spyder-kernelspackage adds a small dependency footprint (~2 MB) to every environment you connect. - Remote interpreters (SSH, Docker, WSL) are not covered here; they require Spyder's "Connect to external kernel" workflow and additional network configuration.
Quick Verification Command
Run this one-liner in any Spyder IPython console to confirm you're where you think you are:
import sys, spyder_kernels; print(f"exe: {sys.executable}\nkernels: {spyder_kernels.__version__}")
If the executable path points inside your project environment and the kernel version is compatible, the configuration is correct.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.