question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flickering interpreter selection panel does not allow to select a Python interpreter

See original GitHub issue

VS Code version

Version: 1.63.0-insider (user setup) Commit: 3a79384dbf81dc6eba781ff669996d2042ca3b72 Date: 2021-11-11T05:15:37.996Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22000

Extension version

v2021.11.1422169775

OS type

Windows

OS version

11

Python distribution

python.org

Python version

3.9.2

Language server

Default

Expected behaviour

I should be able to select a Python interpreter from the selection panel

Actual behaviour

First, I think it is relevant to explain my project setup: I am running my project inside a Docker container using the remote containers extension. This project uses 3 containers, a back-end (written in Python), a front-end (NodeJS + React) and a workspace container that VSCode will connect to once it finishes the docker-compose setup. It might not be relevant to the issue, but here is my devcontainer.json file:

{
  "name": "team32_project",
  "dockerComposeFile": ["../docker-compose.yml", "docker-compose.workspace.yml"],

  // The name of the service VS Code should connect to once running and
  // an array of services that should be started by VS Code
  "service": "workspace",
  "runServices": ["back-end", "front-end"],

  // Default path that VS Code should open when connecting to the container
  "workspaceFolder": "/team32_project",

  // Set *default* container specific settings on container create
  "settings": {
    // Automatically format Python code
    "python.defaultInterpreterPath": "${containerWorkspaceFolder}/back-end/.venv/bin/python",
    "python.formatting.provider": "black",

    // Automatically format JavaScript, TypeScript and JSON code
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "prettier.configPath": "${containerWorkspaceFolder}/front-end/.prettierrc",
    "eslint.workingDirectories": ["${containerWorkspaceFolder}/front-end"],

    "editor.formatOnSave": true
  },

  // Extensions that should be installed inside the container when it is created
  "extensions": [
    // Language support extensions
    "bungcip.better-toml",
    "ms-python.python",

    // Formatting, linting and similar extensions
    "dbaeumer.vscode-eslint",
    "editorconfig.editorconfig",
    "esbenp.prettier-vscode"
  ]
}

and here is workspace container Dockerfile:

FROM alpine:3.14

WORKDIR /team32_project

# Install system dependencies
RUN apk update \
  && apk upgrade \
  && apk add --no-cache git

# Leave the container running so we can interact with it
CMD ["tail", "-f", "/dev/null"]

As you can see, I specified a suggested Python interpreter using the python.defaultInterpreterPath, but it is not working at the moment. Once opened, the interpreter selection panel starts rapidly flickering and thus I cannot choose the interpreter. Moreover, when I try to select it manually, it does not work either. (you can see this behaviour in the youtube video that I linked below)

I tried to setup a multi-root workspace with no luck (I know that the extension does not support virtualenvs that are not in the project’s root directory)

Note: I also tried installing Python 3.9.2 inside the workspace container and it gets recognized without issues, but my objective is to use the project’s virtual environment rather than the system’s one to have IntelliSense support for the packages that I’m using

Steps to reproduce

Unfortunately, the issue is difficult to describe without some evidence material, so I uploaded a short video of what I am experiencing: https://youtu.be/ivXpR4CbOhU

First, I try to select the interpreter under the back-end project root (as you can see by the path, which is ./.venv/bin/python). Then, I try the same thing with the other project root (the path here is correct too, ./back-end/.venv/bin/python). Eventually, I try to enter it manually but it still does not work

Logs

No response

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

1reaction
karrtikrcommented, Dec 12, 2021

Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.

0reactions
karrtikrcommented, Jan 13, 2022

Please try the fix mentioned in https://github.com/microsoft/vscode-python/issues/18234#issuecomment-1012083554, if you still face the issue please provide the following info https://github.com/microsoft/vscode-python/issues/18007#issuecomment-998797786 and I’ll be happy to reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I can't select the Interpreter in Visual Studio Code
It seems that VS Code Editor can't find your python executable. Check if it's installed where VS Code thinks it's installed.
Read more >
"Invalid python interpreter selected" prompt vscode
Use Ctrl + Shift + P to open the command palette · search for Python:Select Interpreter (or click select interpreter in the lower...
Read more >
MicroPython Program ESP32/ESP8266 VS Code and Pymakr
In this guide, you'll learn how to program your ESP32 and ESP8266 boards with MicroPython using VS Code Editor (Visual Studio Code) with...
Read more >
Configure a Python interpreter | PyCharm Documentation
Press Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. · Expand the list of the available interpreters...
Read more >
How to Use Python: Your First Steps
Strongly typed: It won't let unsafe operations on incompatible types go ... in your code but are ignored by the Python interpreter as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found