Skip to content

Pylint uses interpreter from incorrect workspace - v2026.4.0 #804

@wp-pelleys

Description

@wp-pelleys

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda): 3.14.3 installed via uv
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): venv
  • Operating system (and version): macos Tahoe 26.4 (25E246)
  • Version of tool extension you are using: 2026.4.0

I am using "from environment" pylint, version 4.0.5 in both environments (also reproduced on a 3.7 version, thinking that an upgrade might help).

Behaviour

Expected Behavior

My vscode workspace is a multi-rooted workspace, 2 of which are python projects. Each python project has its own .venv and I have manually assigned each to the respective workspace using the Python: Select Interpretter vscode command. I verified this is recognized by opening python files from the 2 workspaces and verifying that the python toolbar in the lower right corner lists the correct workspace interpreter.

This works on v2025.2.0. I expect it to work the same on v2026.4.0. At least, I don't see any changes in the release notes at https://github.com/microsoft/vscode-pylint/releases/tag/v2026.4.0 that explain this.

Actual Behavior

I get import errors on the first line of every file because it is using the wrong interpreter it cannot resolve modules -- the workspaces have different packages installed. See logs below for evidence.

Rolling back to v2025.2.0 fixes it, re-installing v2026.4.0 reproduces the issue.

Reproduction Steps:

I assume this is caused simply by multi-root workspaces with distinct python interpreters. I've not yet tried to create a simplified reproduction.

Logs:

2026-04-30 13:42:34.930 [info] /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/data_schema/.venv/bin/python -m pylint --version
2026-04-30 13:42:34.931 [info] CWD Linter: /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1
2026-04-30 13:42:35.291 [info] 
pylint 4.0.5
astroid 4.0.3
Python 3.14.4 (main, Apr  7 2026, 13:13:20) [Clang 21.0.0 (clang-2100.0.123.102)]


2026-04-30 13:42:35.292 [info] Version info for linter running for /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1:
pylint 4.0.5
astroid 4.0.3
Python 3.14.4 (main, Apr  7 2026, 13:13:20) [Clang 21.0.0 (clang-2100.0.123.102)]

2026-04-30 13:42:35.292 [info] SUPPORTED pylint>=2.14.0
FOUND pylint==4.0.5

##### THE SECTION THAT MATTERS
##### running --version from data_schema/.venv and then declaring the version info for the python/ workspace

2026-04-30 13:42:35.293 [info] /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/data_schema/.venv/bin/python -m pylint --version
2026-04-30 13:42:35.294 [info] CWD Linter: /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/python
2026-04-30 13:42:35.295 [info] 
pylint 4.0.5
astroid 4.0.3
Python 3.14.4 (main, Apr  7 2026, 13:13:20) [Clang 21.0.0 (clang-2100.0.123.102)]


2026-04-30 13:42:35.296 [info] Version info for linter running for /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/python:
pylint 4.0.5
astroid 4.0.3
Python 3.14.4 (main, Apr  7 2026, 13:13:20) [Clang 21.0.0 (clang-2100.0.123.102)]

2026-04-30 13:42:35.297 [info] SUPPORTED pylint>=2.14.0
FOUND pylint==4.0.5

#### END SECTION THAT MATTERS

2026-04-30 13:42:35.298 [info] /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/data_schema/.venv/bin/python -m pylint --version
2026-04-30 13:42:35.298 [info] CWD Linter: /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/data_schema
2026-04-30 13:42:35.300 [info] 
pylint 4.0.5
astroid 4.0.3
Python 3.14.4 (main, Apr  7 2026, 13:13:20) [Clang 21.0.0 (clang-2100.0.123.102)]


2026-04-30 13:42:35.302 [info] Version info for linter running for /Users/pelleys/repos/content-enhancement-service.worktrees/content-enhancement-service-1/data_schema:
pylint 4.0.5
astroid 4.0.3
Python 3.14.4 (main, Apr  7 2026, 13:13:20) [Clang 21.0.0 (clang-2100.0.123.102)]

Outcome When Attempting Debugging Steps:

Command line works just fine, but running from the command line requires that I select the interpreter.

Extra Details

# content-enhancement-service.code-workspace
{
    "folders": [
        {
            "name": "root",
            "path": "."
        },
        {
            "path": "python"
        },
        {
            "path": "data_schema"
        },
    ],
    "settings": {
        "python.analysis.typeCheckingMode": "off"
    }
}
# python/.vscode/settings.json
{
    "python.testing.pytestEnabled": true,
    "python.testing.unittestEnabled": false,
    "python.testing.pytestArgs": [
        "tests"
    ],
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit"
        },
        "editor.rulers": [88],
    },
    "pylint.importStrategy": "fromEnvironment",
}
# data_schema/.vscode/settings.json
{
    "python.testing.pytestEnabled": true,
    "python.testing.unittestEnabled": false,
    "python.testing.pytestArgs": [
        "tests"
    ],
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit"
        },
    },
    "pylint.importStrategy": "fromEnvironment",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bugtriage-neededIssue is not triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions