Skip to content

[Bug] Runs Python script before activating the virtual environment #1238

@adamerose

Description

@adamerose

Describe the bug
Running Python scripts fails because it tries sourcing the venv only after running the file.

✓ 57ms
 Sandbox  >  python -u "c:\_MyFiles\Programming\Sandbox\main.py"
Traceback (most recent call last):
  File "c:\_MyFiles\Programming\Sandbox\main.py", line 1, in <module>
    import sklearn
ModuleNotFoundError: No module named 'sklearn'

✗ 84ms
 Sandbox  >  source /C/_MyFiles/Programming/Sandbox/.venv/Scripts/activate
  • Code Runner Version: 2.2.5
  • VS Code Version:
Version: 1.104.1 (system setup)
Commit: 0f0d87fa9e96c856c5212fc86db137ac0d783365
Date: 2025-09-17T23:36:24.973Z
Electron: 37.3.1
ElectronBuildId: 12404162
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Windows_NT x64 10.0.22631

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions