Skip to content

While use multi-root workspace, avoid setup python interpreter in non-python project #22475

@cuserdzy

Description

@cuserdzy

Type: Bug

Behaviour

Expected vs. Actual

I have a test monorepo project with multi-root workspace, here all two modules proj_a/ and proj_b/, the former one is a python project while the later one is golang project.
I use poetry for proj_a/ and the folder contains a .venv directory

In the .code-workspace file:

{
  "folders": [
    {
      "path": "proj_a"
    },
    {
      "path": "proj_b"
    }
  ],
  "settings": {
    "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
    "[python]": {
      "editor.defaultFormatter": "ms-python.black-formatter",
      "editor.formatOnSave": true
    }
  }
}

While I open the workspace, the vscode-python extension starts work and try to setup interpreter for both proj_a/ and proj_b/ and obviously it fails on proj_b/ with below error message in output.

2023-11-14 18:06:55.192 [warning] Failed to check if /Users/***/Downloads/test_monorepo/proj_b/.venv/bin/python is an executable [Error: ENOENT: no such file or directory, lstat '/Users/***/Downloads/test_monorepo/proj_b/.venv/bin/python'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/***/Downloads/test_monorepo/proj_b/.venv/bin/python'
}
2023-11-14 18:06:55.216 [warning] Identifier for virt-virtualenv failed to identify /Users/***/Downloads/test_monorepo/proj_b/.venv/bin/python [Error: ENOENT: no such file or directory, scandir '/Users/***/Downloads/test_monorepo/proj_b/.venv/bin'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/Users/***/Downloads/test_monorepo/proj_b/.venv/bin'
}

Alought the python extension can work on proj_a/ but the error message is quite massive and noisy while debug other issues.

Extension version: 2023.21.13141007
VS Code version: Code 1.84.2 (Universal) (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:52:33.687Z)
OS version: Darwin arm64 22.6.0
Modes:

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions