[DOCS] VS Code extension settings table missing usePythonEnvironment setting

Resolved 💬 22 comments Opened Jan 28, 2026 by coygeek Closed Feb 28, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/vs-code

Section/Topic

"Extension settings" section under "Configure settings"

Current Documentation

The extension settings table lists these settings:

| Setting | Default | Description | | --- | --- | --- | | selectedModel | default | Model for new conversations. Change per-session with /model. | | useTerminal | false | Launch Claude in terminal mode instead of graphical panel | | initialPermissionMode | default | Controls approval prompts: default (ask each time), plan, acceptEdits, or bypassPermissions | | preferredLocation | panel | Where Claude opens: sidebar (right) or panel (new tab) | | autosave | true | Auto-save files before Claude reads or writes them | | useCtrlEnterToSend | false | Use Ctrl/Cmd+Enter instead of Enter to send prompts | | enableNewConversationShortcut | true | Enable Cmd/Ctrl+N to start a new conversation | | hideOnboarding | false | Hide the onboarding checklist (graduation cap icon) | | respectGitIgnore | true | Exclude .gitignore patterns from file searches | | environmentVariables | [] | Set environment variables for the Claude process. Use Claude Code settings instead for shared config. | | disableLoginPrompt | false | Skip authentication prompts (for third-party provider setups) | | allowDangerouslySkipPermissions | false | Bypass all permission prompts. Use with extreme caution. | | claudeProcessWrapper | - | Executable path used to launch the Claude process |

What's Wrong or Missing?

The claudeCode.usePythonEnvironment setting is missing from the extension settings table.

This setting was added in version 2.1.21 (per the CHANGELOG.md) and enables automatic Python virtual environment activation, ensuring python and pip commands use the correct interpreter when working in Python projects.

Suggested Improvement

Add a new row to the extension settings table:

| Setting | Default | Description |
| --- | --- | --- |
| usePythonEnvironment | (unknown) | Automatically activate Python virtual environments, ensuring python and pip commands use the correct interpreter |

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

| Page | Section |
|------|---------|
| https://code.claude.com/docs/en/vs-code | Extension settings table |

Source: Claude Code v2.1.21 CHANGELOG.md states:

Python Virtual Environment (VSCode): Added automatic Python virtual environment activation, ensuring python and pip commands use the correct interpreter (configurable via claudeCode.usePythonEnvironment setting)

View original on GitHub ↗

22 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/19409
  2. https://github.com/anthropics/claude-code/issues/17770
  3. https://github.com/anthropics/claude-code/issues/21138

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Tectract · 5 months ago

Can anyone tell me how to install pip and other python packages from within this claude container? It's pretty useless for me without any access to pip or python modules...

coygeek · 5 months ago

Hey @Tectract - good question! I think there might be some confusion about how Claude Code works.

Claude Code runs locally on your machine, not in a container. It has full access to your local Python installation, pip, and any packages you've installed. There's no sandboxed container limiting what you can do.

Quick Fix: Activate Your Virtual Environment First

Before launching Claude Code, activate your Python environment in the terminal:

# Using venv
source /path/to/your/venv/bin/activate

# Or using conda
conda activate myenv

# Then start Claude Code
claude

Once activated, Claude can use python and pip from that environment. For example, you can ask Claude to:

  • Run pip install requests to install packages
  • Execute Python scripts with your venv's interpreter
  • Access any packages already installed in the environment

For VS Code Users

The VS Code extension has a claudeCode.usePythonEnvironment setting (added in v2.1.21) that automatically activates Python virtual environments. This is actually what the original issue is about - this setting isn't documented yet, but it exists!

To enable it:

  1. Open VS Code Settings (Cmd+, / Ctrl+,)
  2. Search for "usePythonEnvironment"
  3. Enable the setting

Persistent Environment Setup

If you want your environment to persist across all Claude Code Bash commands, you can use the CLAUDE_ENV_FILE approach:

# Create an env setup script
echo 'source /path/to/venv/bin/activate' > ~/.claude-env-setup.sh

# Set it before launching Claude
export CLAUDE_ENV_FILE=~/.claude-env-setup.sh
claude

Claude will source this file before each Bash command, keeping your environment active.

Note on "Claude Code on the Web"

If you're using Claude Code on the web (the browser version at claude.ai), that does run in an isolated VM. But the local CLI and VS Code extension run directly on your machine with full access to your development tools.

---

Let me know if you're still having trouble.

Tectract · 5 months ago

I'm running claude in a container using dev containers within VSCode. Isn't that what this repo is for?

I added the line

python3-pip \

in the dockerfile, under RUN apt-get, and now it SEES pip from the terminal, but I still can't install module yfinance.

pip3 install yfinance
error: externally-managed-environment

× This environment is externally managed
To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

coygeek · 5 months ago

Ah, Dev Containers! The "externally-managed-environment" error you're seeing is a Python/Debian thing (PEP 668), not specific to Claude Code. Modern Debian-based images block system-wide pip installs to prevent breaking the OS Python.

Quick Fix: Create a venv in your container

Add this to your Dockerfile:

# Create a virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Now pip works without issues
RUN pip install yfinance

Or if you want to do it interactively after the container starts:

python3 -m venv ~/.venv
source ~/.venv/bin/activate
pip install yfinance

Alternative: Use pipx for CLI tools

If you just need to run a Python package as a command-line tool:

RUN apt-get install -y pipx
RUN pipx install yfinance

Alternative: Override the restriction (not recommended)

You can force it with --break-system-packages, but this can cause issues:

pip install --break-system-packages yfinance

For Claude Code specifically

Once you have a working Python environment in your container, Claude Code will use it. If you set up the venv in your Dockerfile, Claude will automatically have access to pip and your installed packages.

If you're launching Claude Code from a terminal where the venv is already activated, everything should just work. You can also use the CLAUDE_ENV_FILE approach I mentioned earlier to auto-activate the venv for each Bash command Claude runs.

---

The Dev Containers setup is a good approach - just need to handle the venv inside the container. Let me know if you hit any other snags!

Tectract · 5 months ago

I added these lines belog the RUN apt-get section of the dockerfile
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

result: container failed to build:

Dockerfile-with-features:33
--------------------
31 | && apt-get clean && rm -rf /var/lib/apt/lists/*
32 |
33 | >>> RUN python3 -m venv /opt/venv
34 | ENV PATH="/opt/venv/bin:$PATH"
35 |
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c python3 -m venv /opt/venv" did not complete successfully: exit code: 1

Tectract · 5 months ago

tried to use the command:
python3 -m venv ~/.venv

in the container, after 'sudo apt-get install python3-venv' and rebuilding the container...

python3 -m venv ~/.venv

The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.11-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: /home/node/.venv/bin/python3

Tectract · 5 months ago

pip3 install --break-system-packages yfinance

Usage:
pip3 install [options] <requirement specifier> [package-index-options] ...
pip3 install [options] -r <requirements file> [package-index-options] ...
pip3 install [options] [-e] <vcs project url> ...
pip3 install [options] [-e] <local project path> ...
pip3 install [options] <archive url/path> ...

no such option: --break-system-packages

Tectract · 5 months ago

sadly seems like I'm totally locked out of using pip here. Help? anyone?

coygeek · 5 months ago

The container is missing the venv packages. Here's a complete fix:

Complete Dockerfile Fix

Add these lines to your Dockerfile (before attempting to create the venv):

# Install Python venv support (version-specific package required on Debian)
RUN apt-get update && apt-get install -y \
    python3-venv \
    python3.11-venv \
    python3-full \
    && rm -rf /var/lib/apt/lists/*

# Now create the venv
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Install your packages
RUN pip install yfinance

The key is installing python3.11-venv (or whatever version matches your Python) - the generic python3-venv package alone isn't enough on Debian/Ubuntu.

If You Can't Modify the Dockerfile

Run these commands inside your container:

# Install the venv package (need sudo)
sudo apt-get update
sudo apt-get install -y python3.11-venv python3-full

# Create and activate venv
python3 -m venv ~/.venv
source ~/.venv/bin/activate

# Now pip works
pip install yfinance

Alternative: Use uv (Recommended)

uv is a fast Python package manager that handles venvs automatically and doesn't hit PEP 668 issues:

# Install uv (works without sudo)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install packages directly (uv manages the venv for you)
uv pip install yfinance

# Or create a project with dependencies
uv init
uv add yfinance

This is actually what Anthropic recommends in their Agent SDK docs.

About the --break-system-packages flag

That flag was added in pip 23.0. Your container has an older pip. You could upgrade pip first, but honestly the venv approach is cleaner:

# If you really want to upgrade pip first
python3 -m pip install --upgrade pip
# Then --break-system-packages would work (but still not recommended)

---

The root issue is that Dev Container base images often have minimal Python setups. Adding python3.11-venv and python3-full to your Dockerfile should get you unstuck. Let me know if you hit anything else!

Tectract · 5 months ago

(from within container)
sudo apt-get update
[sudo] password for node:

what is the password? I have no idea. Isn't the point of the container to prevent sudo commands that could alter the outside system?

sudo apt-get install python3-full:

E: Unable to locate package python3-full

sudo apt-get install python3.11-venv

E: Unable to locate package python3.11-venv

These appear to be non-existent packages in the default WSL ubuntu "focal" repos.

curl -LsSf https://astral.sh/uv/install.sh | sh

this worked and installed uv within my WSL command line...

however within the container:

uv

zsh: command not found: uv

curl -LsSf https://astral.sh/uv/install.sh | s

curl: (7) Failed to connect to astral.sh port 443 after 55 ms: Couldn't connect to server

So we are getting nowhere fast, here.

Can I add astral.sh to the allowed hosts file, maybe? and then it could get uv within the container? I'll try that, I guess...

coygeek · 5 months ago

Ah, Ubuntu Focal (20.04) - that explains a lot! The packages I mentioned are for newer Ubuntu versions. And the network restriction is blocking external downloads.

The fix has to happen in the Dockerfile (at build time), not inside the running container. Here's what should work:

For Ubuntu Focal (20.04)

Focal uses Python 3.8 by default, so use python3.8-venv:

# Add this to your Dockerfile
RUN apt-get update && apt-get install -y \
    python3-pip \
    python3-venv \
    python3.8-venv \
    && rm -rf /var/lib/apt/lists/*

# Create venv and add to PATH
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Pre-install packages you need
RUN pip install --upgrade pip && pip install yfinance

Finding Your Dockerfile

Since you're using VS Code Dev Containers, look for one of these:

  • .devcontainer/Dockerfile
  • .devcontainer/devcontainer.json (may reference a Dockerfile or use a features section)

If your devcontainer.json uses a prebuilt image without a Dockerfile, you can add a postCreateCommand:

{
  "postCreateCommand": "python3 -m venv ~/.venv && source ~/.venv/bin/activate && pip install yfinance"
}

But this still requires the venv packages to exist in the base image.

About the Network Issue

The container can't reach astral.sh because Dev Containers often restrict network access. If you need to allow specific hosts, check your devcontainer.json for network settings, or ask your DevOps team about the network policy.

About Sudo

The default password for the node user varies by base image. Common options:

  • node
  • password
  • Or it might not have a password set (passwordless sudo might work: sudo -n apt-get update)

But really, you shouldn't need sudo if the Dockerfile installs the packages at build time.

---

TL;DR: The packages need to be in the Dockerfile. For Focal, use python3.8-venv instead of python3.11-venv. Can you share what base image or devcontainer config you're using? That would help pinpoint the exact fix.

Tectract · 5 months ago

Add this to your Dockerfile
RUN apt-get update && apt-get install -y \
python3-pip \
python3-venv \
python3.8-venv \
&& rm -rf /var/lib/apt/lists/*

on rebuild (is it using bookworm repos? I though WSL was using focal repos???)

=> ERROR [dev_container_auto_added_stage_label 3/12] RUN apt-get update && apt-get install -y python3-pip python3-venv python3.8-venv && rm -rf /var/lib/apt/lists/* 3.7s
------

 > [dev_container_auto_added_stage_label  3/12] RUN apt-get update && apt-get install -y     python3-pip     python3-venv     python3.8-venv     && rm -rf /var/lib/apt/lists/*:                                                                                                                                         
0.636 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]                                                                                                                                                                                                                                                     
0.704 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]                                                                                                                                                                                                                                            
0.818 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]                                                                                                                                                                                                                                  
0.868 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8792 kB]                                                                                                                                                                                                                                          
1.291 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [6924 B]
1.303 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [293 kB]
2.117 Fetched 9346 kB in 2s (5981 kB/s)
2.117 Reading package lists...
2.753 Reading package lists...
3.319 Building dependency tree...
3.507 Reading state information...
3.589 E: Unable to locate package python3.8-venv
3.589 E: Couldn't find any package by glob 'python3.8-venv'
3.589 E: Couldn't find any package by regex 'python3.8-venv'
------
Dockerfile-with-features:32
--------------------
  31 |     
  32 | >>> RUN apt-get update && apt-get install -y \
  33 | >>>     python3-pip \
  34 | >>>     python3-venv \
  35 | >>>     python3.8-venv \
  36 | >>>     && rm -rf /var/lib/apt/lists/*
  37 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y     python3-pip     python3-venv     python3.8-venv     && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
Tectract · 5 months ago

When I do > sudo apt-get update under the WSL terminal this is what I see:

sudo apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done

So I'm surprised it is trying to use bookworm repos within the container... Shouldn't those be the same?

when I type > less /etc/apt/sources.list.d/debian.sources (within the container terminal)
I see this:

Types: deb
# http://snapshot.debian.org/archive/debian/20260112T000000Z
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb
# http://snapshot.debian.org/archive/debian-security/20260112T000000Z
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

So now I'm super confused. Why is the container using different ubuntu repos than my WSL system???

Tectract · 5 months ago

passwords for > sudo apt-get update (within the container)
[sudo] password for node:

tried node, tried password, no dice. Are we just guessing here? Shouldn't that be part of the dockerfile settings or something? Shouldn't it properly NOT run sudo commands within the container? very confused. Feel like we are not making progress.

Using pip within a container seems impossible.

Tectract · 5 months ago

from the origina comment here:

What's Wrong or Missing?

The claudeCode.usePythonEnvironment setting is missing from the extension settings table.

This setting was added in version 2.1.21 (per the CHANGELOG.md) and enables automatic Python virtual environment activation, ensuring python and pip commands use the correct interpreter when working in Python projects.

Is this the core cause of the problem? Can I just update the "extension settings table" somehow to enable pip within the terminal again, somehow?

coygeek · 5 months ago

WSL vs Container - Two Different Systems

This is the source of confusion:

| System | OS | Where |
|--------|-----|-------|
| WSL | Ubuntu Focal (20.04) | Your Windows machine, outside the container |
| Dev Container | Debian Bookworm (12) | Inside Docker, isolated from WSL |

When you open the terminal in VS Code with a Dev Container, you're inside the container (Debian Bookworm), not in WSL. They're completely separate operating systems with different package repos.

So python3.11-venv is the right package for your container (Bookworm has Python 3.11), but you can't install it because of the sudo password issue.

About usePythonEnvironment

Unfortunately, that setting won't help here. It auto-activates existing virtual environments - it doesn't create them or install packages. You still need a working Python/venv setup first.

The Real Fix: Modify the Dockerfile

The container's Python setup needs to happen at build time in the Dockerfile. You can't easily fix it from inside a running container without sudo access.

Quick question: What Dev Container are you using? Is it:

  1. The official Claude Code Dev Container from this repo?
  2. A custom devcontainer.json you or your team created?
  3. A prebuilt image from somewhere else?

If you can share your .devcontainer/devcontainer.json (and Dockerfile if there is one), I can show you exactly what lines to add.

Workaround: Rebuild with Python Setup

If you have access to the devcontainer config, add this to your Dockerfile:

# For Debian Bookworm (Python 3.11)
RUN apt-get update && apt-get install -y \
    python3-pip \
    python3-venv \
    && rm -rf /var/lib/apt/lists/*

RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install yfinance

Or in devcontainer.json, you can add a feature:

{
  "features": {
    "ghcr.io/devcontainers/features/python:1": {
      "version": "3.11"
    }
  }
}

This installs Python properly with venv support.

---

TL;DR: The usePythonEnvironment setting is unrelated to your issue - it's about auto-activating existing venvs. Your container needs Python packages installed at build time. Share your devcontainer config and I can give you the exact fix!

coygeek · 5 months ago

Found the issue! I looked at the official Claude Code dev container config.

The Problem

The official Claude Code dev container is Node.js focused - it doesn't include Python virtual environment support. Here's what's happening:

  1. No Python venv packages - The Dockerfile only installs Node.js tools, not python3-venv
  2. Network firewall - The init-firewall.sh script restricts outbound connections to only:
  • GitHub (api.github.com, etc.)
  • npm registry
  • api.anthropic.com
  • VS Code marketplace
  • statsig.com/sentry.io

astral.sh is NOT in the allowed list - that's why curl -LsSf https://astral.sh/uv/install.sh failed with "Couldn't connect to server"

  1. Limited sudo - Only /usr/local/bin/init-firewall.sh has NOPASSWD in sudoers

The Fix

You need to modify the Dockerfile to add Python support. Fork/copy the .devcontainer folder and add these lines:

# Add after the existing apt-get install block (around line 9-10)
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3-pip \
    python3-venv \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Add after the USER node line
RUN python3 -m venv /home/node/.venv
ENV PATH="/home/node/.venv/bin:$PATH"

# Pre-install any Python packages you need
RUN pip install --upgrade pip && pip install yfinance

Alternative: Use a Dev Container Feature

In your devcontainer.json, add the Python feature:

{
  "features": {
    "ghcr.io/devcontainers/features/python:1": {
      "version": "3.11",
      "installTools": true
    }
  }
}

This installs Python with pip and venv support without modifying the Dockerfile.

If You Need uv

Add astral.sh to the firewall allowed domains in init-firewall.sh (line ~60):

for domain in \
    "registry.npmjs.org" \
    "api.anthropic.com" \
    "astral.sh" \           # <-- Add this line
    ...

---

TL;DR: The official Claude Code container is designed for Node.js development, not Python. To use Python with pip, you need to either:

  1. Add python3-venv to the Dockerfile, or
  2. Add the Python devcontainer feature to devcontainer.json

This might actually be worth a separate feature request - asking Anthropic to include Python support in the official dev container since Claude Code is commonly used for Python projects too.

Tectract · 5 months ago

In your devcontainer.json, add the Python feature:

"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.11",
"installTools": true
}
}

ok we are close here. pip is now available in the command line within the container.

yet still:

pip install yfinance

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75da898997d0>: Failed to establish a new connection: [Errno 113] No route to host')': /simple/yfinance/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75da8989a6d0>: Failed to establish a new connection: [Errno 113] No route to host')': /simple/yfinance/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75da8989afd0>: Failed to establish a new connection: [Errno 113] No route to host')': /simple/yfinance/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75da8989bf50>: Failed to establish a new connection: [Errno 113] No route to host')': /simple/yfinance/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75da8989cbd0>: Failed to establish a new connection: [Errno 113] No route to host')': /simple/yfinance/
ERROR: Could not find a version that satisfies the requirement yfinance (from versions: none)
ERROR: No matching distribution found for yfinance

Tectract · 5 months ago

Yes, finally, the solution here was to add teh python feature in the devcontainer, and then add these lines to the init-firewall.sh script ass allowed domains;

"pypi.python.org" \
"files.pythonhosted.org" \

finally, pip install yfinance is working without errors.

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.