VSCode Cannot Find Flake8 (Invalid Path) or Thinks it isn't installed (is not installed) (Using win-pyenv)
See original GitHub issueType: Bug
Behaviour
Expected vs. Actual
Setup:
- Latest VSCode (1.71.2 commit date 2022-09-14)
- Latest Python Extension (v2022.14.0)
- Latest Pylance Extension (v2022.9.40)
- Pylance set as language server.
- Using win-pyenv with Python 3.10.7 installed and activated.
- Installed flake8 via pip.
- Set linting and flake8 enabled to true.
- Validated via CLI that flake8 <file> works.
- Validated via CLI that python -m flake8 <file> works.
- Validated via CLI that C:\Users<user>.pyenv\pyenv-win\shims\flake8 <file> works.
- Open python file.
Expected behavior is that flake8 linter works. Instead, I get one of two pop-up error messages from the Python extension. I always get one but sometimes it is one or the other.
“Path to the flake8 linter is invalid (C:\Users<user>.pyenv\pyenv-win\shims\flake8)”
~or~
“Linter flake8 is not installed.”
My settings for path to flake8 is currently default so it just is “flake8” which works from the CLI. I have tried putting the full correct path but either way the error occurs.
Steps to reproduce:
- Install pyenv-win
- I Install from Chocolatey
- Install and activate Python 3.10.7
- pyenv update
- pyenv install 3.10.7
- pyenv global 3.10.7
- Install flake8
- pip install flake8
- Install VSCode 1.71.2
- Install and Activate Latest Python Extension
- Install and Activate Latest Pylance Extension
- Set Language Server to Pylance
- Set linting and flake8 enabled to true.
- Open python file.
C:\Users<user>.pyenv\pyenv-win\shims\flake8 is where flake8 (and python, and pip) should be if pyenv-win is installed, any supported version of python is installed, and flake8 is installed.
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.7
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
- Value of the
python.languageServer
setting: Pylance
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
User Settings
languageServer: "Pylance"
linting
• flake8Args: "<placeholder>"
• flake8Enabled: true
• flake8Path: "<placeholder>"
• pylintArgs: "<placeholder>"
formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• blackArgs: "<placeholder>"
Extension version: 2022.14.0 VS Code version: Code 1.71.2 (74b1f979648cc44d385a2286793c226e611f59e7, 2022-09-14T21:03:37.738Z) OS version: Windows_NT x64 10.0.19044 Modes: Sandboxed: No
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
@bwfisher82 I recommend trying https://marketplace.visualstudio.com/items?itemName=ms-python.flake8 and https://marketplace.visualstudio.com/items?itemName=ms-python.autopep8 extension. There are currently in preview, and will be the eventual home of these features. An advantage with those is that, they are shipped with the tools so you don’t have to install, and have better integration with the tools. They should be generally more performant.
Closing this since we have started the process of migrating users to the new extensions.