Skip to content

VS Code Python Extension Stuck on Reactivating Terminals

Problem Statement

After updating Visual Studio Code to version 1.92 or later, many users encounter an issue where the Python extension fails to initialize properly. Instead of loading, VS Code gets stuck indefinitely with a status bar message saying "Reactivating terminals..." accompanied by a spinning indicator.

When inspecting the Output > Python logs, you'll typically see an error similar to:

bash
[error] sendStartupTelemetry() failed. s [Error]: Failed to resolve env "/mnt/data-linux/miniconda3"

This problem often prevents standard Python functionality in VS Code and interrupts development workflows. It's commonly triggered by:

  • VS Code updates that introduce incompatible changes
  • Corrupted virtual environments or cache files
  • Conflicts between Python environment management tools (Conda, virtualenv, etc.)
  • Issues with Python path resolution in the extension

Primary Solutions

1. Switch Python Locator Engine

This solution resolved the issue for over 140 users:

  1. Open VS Code settings (Ctrl+, or Cmd+,)
  2. Search for "Python Locator"
  3. Change the value from native to js
  4. Restart VS Code

Python Locator setting in VS Code

WARNING

This reverts to the legacy locator system. While effective, this workaround is temporary and may lack long-term support as Microsoft transitions to the native locator.

2. Update Python Extension

After September 2024, versions of the Python extension >= 2024.14.1 contain critical fixes:

  1. Open VS Code extensions view (Ctrl+Shift+X)
  2. Find the Python extension
  3. Click the update button (cloud icon)
  4. Reload the extension host when prompted

Python Extension Update

Proactive Maintenance

Enable automatic updates in VS Code:

json
"extensions.autoUpdate": true

3. Recreate Corrupted Virtual Environments

If you see path errors in logs referencing /mnt or /tmp, recreate your environment:

bash
rm -rf .venv           # Delete corrupted environment
python -m venv .venv   # Create fresh environment
source .venv/bin/activate  # Linux/Mac
.venv\Scripts\activate     # Windows
which python           # Verify correct path

4. Clear Python Extension Cache

  1. Open command palette (Ctrl+Shift+P or Cmd+Shift+P)
  2. Run Python: Clear Cache
  3. Select Python: Clear Cache and Reload Window

Secondary Solutions

5. Reset Environment Selection

  1. Open command palette (Ctrl+Shift+P)
  2. Find Python: Select Interpreter
  3. Choose your environment again

6. Fix Terminal Environment Inheritance

Add to your settings.json (Ctrl+Shift+P > Preferences: Open User Settings (JSON)):

json
"terminal.integrated.inheritEnv": false

7. Resolve Remote Session Issues

For SSH/CDE sessions:

bash
mv ~/.vscode-server ~/old_vscode-server  # Clear corrupted instance
# Reconnect to trigger fresh installation

Understanding the Cause

This issue typically stems from:

  1. Native locator bugs: The extension's new environment resolution engine fails with certain paths
  2. Environment corruption: Broken symlinks or invalid paths in virtual environments
  3. Cache conflicts: Outdated/stale references to previous Python installations
  4. Permission issues: VS Code lacking access to environment directories

Locate error logs at:

$HOME/.vscode-server/data/logs/<date>/exthost1/ms-python.python/Python Locator.log

When Solutions Don't Work

If issues persist:

  1. Report bugs to the vscode-python GitHub repository
  2. Test in VS Code Insiders edition (often contains latest fixes)
  3. Disable other extensions temporarily to check for conflicts
  4. Verify Python environment integrity (conda validate or python -m ensurepip)

Most users resolve this while maintaining their preferred Python environments. Combining the extension update with a cache reset or environment recreation typically addresses the underlying path resolution issues while keeping your configuration intact.