Skip to content
Happy Programming Guide
Start learning
Python

Conda Command Not Found in VS Code

The terminal inside VS Code does not know about conda. Here is why, and the four fixes — from conda init to selecting the right interpreter.

Black computer keyboard

Conda works in your normal terminal but not in the one inside VS Code. The cause is almost always that VS Code’s integrated terminal starts a shell that never reads the file conda init edited — a different shell, a non-login shell, or one launched before the change. This guide covers the four fixes in the order worth trying them.

Why it happens#

conda is not only a program — activation needs a shell function, because changing PATH in your current shell is something an external process cannot do. conda init installs that function by adding a block to your shell’s startup file.

The integrated terminal fails when it starts a shell that does not read that file:

  • A different shell from your normal one — PowerShell inside VS Code, bash outside
  • A non-login shell, which reads .bashrc but not .bash_profile
  • A terminal opened before conda init ran
  • VS Code launched from a desktop icon rather than from a configured shell, so it inherits a different environment

Fix 1: find out which shell it is#

Terminal
echo $SHELL          # macOS and Linux
POWERSHELL
$PSVersionTable      # confirms you are in PowerShell

In VS Code, the terminal dropdown names the shell type. Then initialise for that one specifically:

Terminal
conda init bash
conda init zsh
conda init powershell
conda init --all

Close every terminal and open a new one. This is the step people skip — conda init edits a startup file, and startup files are only read when a shell starts.

Restart VS Code entirely rather than just the terminal panel, since it caches environment information.

Fix 2: the PowerShell execution policy#

Output
conda : File C:\Users\...\profile.ps1 cannot be loaded because running
scripts is disabled on this system.

PowerShell is refusing to run the profile that conda init wrote:

POWERSHELL
Get-ExecutionPolicy -List
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

CurrentUser scope avoids changing the policy machine-wide. Restart the terminal afterwards.

If your organisation enforces the policy and you cannot change it, switch VS Code’s default terminal to Command Prompt, which does not have this restriction:

JSON
{
  "terminal.integrated.defaultProfile.windows": "Command Prompt"
}

Fix 3: select the interpreter#

This is the one people miss, and it makes the whole problem largely go away.

  1. Ctrl+Shift+P, then Python: Select Interpreter
  2. Choose the one labelled with your conda environment name
  3. Open a new terminal

The Python extension then activates that environment automatically in every new terminal. You get the right interpreter without typing conda activate at all.

JSON
{
  "python.terminal.activateEnvironment": true,
  "python.condaPath": "C:\\Users\\you\\miniconda3\\Scripts\\conda.exe"
}

Setting condaPath explicitly helps when the extension cannot find a conda installed somewhere unusual.

Fix 4: source the script directly#

When you cannot or would rather not modify startup files:

Terminal
source /path/to/miniconda3/etc/profile.d/conda.sh
conda activate myenv

This is also the correct approach inside shell scripts and CI jobs, where startup files are often not read at all:

Terminal
#!/usr/bin/env bash
set -euo pipefail

source "$(conda info --base)/etc/profile.d/conda.sh"
conda activate myproject

python analyse.py

conda info --base finds the installation path, so the script works on any machine.

Confirming what is actually running#

Terminal
conda env list           # the active one is marked with an asterisk
which python             # or "where python" on Windows
python -c "import sys; print(sys.executable)"

That last command is the one to remember. It prints the exact interpreter, and comparing it with where a package was installed answers nearly every “it says it is installed but the import fails” problem.

Stopping base from activating everywhere#

Terminal
conda config --set auto_activate_base false

Conda stays available; it just does not activate anything until you ask. Useful if the (base) prefix on every prompt bothers you, or if it interferes with a system Python you rely on.

Do you need conda at all#

Worth asking. For pure Python projects, the built-in virtual environment tool is simpler and has none of these shell issues:

Terminal
python -m venv .venv
source .venv/bin/activate        # .venv\Scripts\activate on Windows
python -m pip install -r requirements.txt

Conda earns its place when you need non-Python dependencies that pip cannot install — compilers, CUDA, some geospatial and scientific libraries. If none of that applies, venv removes an entire layer of complexity.

Questions people ask#

Why does it work in the external terminal but not in VS Code?

The two are starting different shells, or the same shell with different startup behaviour. VS Code may also have been launched before conda init ran and cached the old environment.

Is it safe to run conda init more than once?

Yes. It detects its own block and will not duplicate it. conda init --reverse removes it again.

Should I add conda to PATH manually?

It makes the conda command available but does not give you the shell function, so conda activate still fails with an “invalid choice” error. Run conda init instead.

Why does the wrong environment activate automatically?

VS Code remembers a selected interpreter per workspace, stored in .vscode/settings.json. Select the right one, or edit that file.

Where to go next#

Virtual environments, the simpler alternative to condaRead next

Keep reading

Python

The List Data Type in Python

Creating, indexing, slicing and modifying lists, the methods worth knowing, and the copying and sorting traps that catch beginners.

5 min read

Keep going — pick your next guide

The fastest way to improve is to read one guide, then build the thing it describes. Start with the basics, or jump straight to a project.

Ask a question or share what worked

Your email address will not be published. Required fields are marked *