Installed pre-commit successfully using the following command in VSCode:
python3 -m pip install pre-commit --user