DevContainer - can't commit - missing modules mypy, slugify, attr

I’m using Windows 10 as my operating system.
I’ve followed the official documentation (Set up Development Environment | Home Assistant Developer Docs) and I was able to add a new component, run HA using run task, but I’m unable to commit, everytime I try to do that I get the following error:

git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
pyupgrade…Passed
black…Passed
codespell…Passed
flake8…Passed
bandit…Passed
isort…Passed
Check JSON…Passed
Don’t commit to branch…Passed
yamllint…(no files to check)Skipped
mypy…Failed

  • hook id: mypy
  • exit code: 1

Traceback (most recent call last):
File “/workspaces/home-assistant/venv/bin/mypy”, line 5, in
from mypy.main import console_entry
ModuleNotFoundError: No module named ‘mypy’

gen_requirements_all…Failed

  • hook id: gen_requirements_all
  • exit code: 1

Traceback (most recent call last):
File “/usr/local/lib/python3.9/runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/local/lib/python3.9/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/workspaces/home-assistant/script/gen_requirements_all.py”, line 11, in
from homeassistant.util.yaml.loader import load_yaml
File “/workspaces/home-assistant/homeassistant/util/init.py”, line 17, in
import slugify as unicode_slug
ModuleNotFoundError: No module named ‘slugify’

hassfest…Failed

  • hook id: hassfest
  • exit code: 1

Traceback (most recent call last):
File “/usr/local/lib/python3.9/runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/local/lib/python3.9/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/workspaces/home-assistant/script/hassfest/main.py”, line 7, in
from . import (
File “/workspaces/home-assistant/script/hassfest/codeowners.py”, line 4, in
from .model import Config, Integration
File “/workspaces/home-assistant/script/hassfest/model.py”, line 9, in
import attr
ModuleNotFoundError: No module named ‘attr’

As mentioned, I’m able to start HA from dev container using Task:Run Task > Run Home Assistant Core.

I have this list of python interpreters:
image
I’ve tried venv and 3.9.6, non of them worked.
Am I missing something? Has anyone had similar problems?

Quick update:
I had to switch python interpreter from venv to /usr/local/bin/python (3.9.6) and comment everything in script/run-in-env.sh except the last line. There seems to be something wrong with venv - when I try to install mypy I get info that it is already installed, but when I try to run it I get error that there is no module named mypy.

This is the output when I use venv:

(venv) root ➜ /workspaces/home-assistant (argon) $ pip install mypy
Requirement already satisfied: mypy in /usr/local/lib/python3.9/site-packages (0.902)
Requirement already satisfied: mypy-extensions<0.5.0,>=0.4.3 in /usr/local/lib/python3.9/site-packages (from mypy) (0.4.3)
Requirement already satisfied: toml in /usr/local/lib/python3.9/site-packages (from mypy) (0.10.2)
Requirement already satisfied: typing-extensions>=3.7.4 in /usr/local/lib/python3.9/site-packages (from mypy) (3.10.0.0)
WARNING: You are using pip version 20.2.4; however, version 21.1.3 is available.
You should consider upgrading via the ‘/usr/local/bin/python -m pip install --upgrade pip’ command.
(venv) root ➜ /workspaces/home-assistant (argon) $ mypy
Traceback (most recent call last):
File “/workspaces/home-assistant/venv/bin/mypy”, line 5, in
from mypy.main import console_entry
ModuleNotFoundError: No module named ‘mypy’
(venv) root ➜ /workspaces/home-assistant (argon) $

Another update:
I’ve tested this on two more computers with Windows 10. Same problem.
Steps:

  1. clone HA Core repo
  2. create a new branch
  3. oven folder in vs code and reopen in dev container (vs code will ask for that)
  4. use scaffold (Creating your first integration | Home Assistant Developer Docs) to create a new integration
  5. commit the changes
  6. the the same errors as I posted above.

The solution was suggested by @janGranada on Discord - https://discordapp.com/channels/330944238910963714/330990195199442944/867355214330724372

The key was to remove the venv folder, because for some reason it was messing everything up.