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.

VSCode Cannot Find Flake8 (Invalid Path) or Thinks it isn't installed (is not installed) (Using win-pyenv)

See original GitHub issue

Type: 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 (ViewOutput, 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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
karthiknadigcommented, Oct 4, 2022

@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.

0reactions
karthiknadigcommented, Nov 12, 2022

Closing this since we have started the process of migrating users to the new extensions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install Python, VSCode, and flake8 correctly on Win10
According to your description, I successfully installed flake8. I think there is a problem with your installation path of flake8.
Read more >
Python Best Practices for a New Project in 2021 - Alex Mitelman
VS Code should pick up your virtual environment and install Flake8 as a development dependency. If it doesn't happen or if you want...
Read more >
vscode-python - bytemeta
VSCode Cannot Find Flake8 (Invalid Path) or Thinks it isn't installed (is not installed) (Using win-pyenv). karthiknadig. karthiknadig OPEN.
Read more >
vscode-python - githubmemory
Last line in pandas dataframe is swallowed in (pytest) debug console ... VSCode Cannot Find Flake8 (Invalid Path) or Thinks it isn't installed...
Read more >
How to install Python, VSCode, and flake8 correctly on Win10
I think there is a problem with your to know installation path of flake8. ... install and it python again and check the...
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