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.

Detection of flake8 is inconsitent/broken in some cases

See original GitHub issue

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.5.0
  • OS and version: Ubuntu 16.04 (w/ latest updates)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): pipenv/virtualenv
  • Relevant/affected Python packages and their versions:
    • pipenv, version 11.10.0

Actual behavior

“Linter Flake8 is not installed.” notification box pops up every time I try to save a Python file.

Expected behavior

Flake8 linting works for python file

Steps to reproduce:

  1. pipenv --python 3.6 shell
  2. code .
  3. pipenv install flake8 --dev
  4. Open Python file in VS code, edit, save.

But, in the VS Code “Terminal” tab, I can do:

(tarsnap-prune-0dGG-SaN)rsyring@loftey:~/projects/tarsnap-prune$ pip freeze
flake8==3.5.0
mccabe==0.6.1
pycodestyle==2.3.1
pyflakes==1.6.0
sh==1.12.14
(tarsnap-prune-0dGG-SaN)rsyring@loftey:~/projects/tarsnap-prune$ python
Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import flake8
>>>
(tarsnap-prune-0dGG-SaN)rsyring@loftey:~/projects/tarsnap-prune$

I have other projects where flake8 linting works fine in vscode.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting the classic analysis engine.

Linter 'flake8' is not installed. Please install it or select another linter".
Error: Module 'flake8' not installed.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

log.ts:159  INFO no standard startup: not using cached data
TMSyntax.ts:44 Overwriting grammar scope name to file mapping for scope source.jinja.
Old grammar file: /data/rsyring/.vscode/extensions/korekontrol.saltstack-0.0.5/syntaxes/jinja.json.
New grammar file: /data/rsyring/.vscode/extensions/wholroyd.jinja-0.0.8/syntaxes/jinja.json
e.register @ TMSyntax.ts:44
TMSyntax.ts:44 Overwriting grammar scope name to file mapping for scope text.yaml.jinja.
Old grammar file: /data/rsyring/.vscode/extensions/korekontrol.saltstack-0.0.5/syntaxes/sls.json.
New grammar file: /data/rsyring/.vscode/extensions/wholroyd.jinja-0.0.8/syntaxes/jinja-yaml.json
e.register @ TMSyntax.ts:44
webviewElement.ts:132 [Embedded Page] Blocked script execution in 'data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Chtml%20lang%3D%22en%22%20style%3D%22width%3A%20100%25%3B%20height%3A%20100%25%22%3E%0D%0A%3Chead%3E%0D%0A%09%3Ctitle%3EVirtual%20Document%3C%2Ftitle%3E%0D%0A%3C%2Fhead%3E%0D%0A%3Cbody%20style%3D%22margin%3A%200%3B%20overflow%3A%20hidden%3B%20width%3A%20100%25%3B%20height%3A%20100%25%22%3E%0D%0A%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
console.ts:136 [Extension Host] vscode-icons is active!
console.ts:136 [Extension Host] Python Extension: Linter 'flake8' is not installed. Please install it or select another linter". Error: Module 'flake8' not installed.
	at PythonExecutionService.<anonymous> (/data/rsyring/.vscode/extensions/ms-python.python-2018.5.0/out/client/common/process/pythonProcess.js:96:27)
	at Generator.next (<anonymous>)
	at fulfilled (/data/rsyring/.vscode/extensions/ms-python.python-2018.5.0/out/client/common/process/pythonProcess.js:12:58)
	at <anonymous>
t.log @ console.ts:136
notificationsAlerts.ts:42 Linter flake8 is not installed.
e.onDidNotificationChange @ notificationsAlerts.ts:42

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
rsyringcommented, Jun 7, 2018

Well, I had deleted and reinstalled the virtualenv so I had to re-install flake8. Once I did so, I have:

$ /data/tmp/virtualenvs/tarsnap-prune-src-eTYfY8x1/bin/python -m flake8 --version
3.5.0 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.6.5 on Linux

And…amazingly?, I no longer have the problem with VS Code. I’m certain I tried that same workflow a couple times before I reported the issue and you can see in my terminal paste above that from inside VS Code, flake8 was installed. But…who knows, it’s working now. Sorry to waste your time. 😮/

0reactions
DonJayamannecommented, Jun 7, 2018
  • Please could you provide the output from the following command in your terminal: /data/tmp/virtualenvs/tarsnap-prune-src-eTYfY8x1/bin/python -m flake8 --version

  • Please confirm you have restarted VS Code after making the changes to the settings.json file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detection of flake8 is inconsitent/broken in some cases #1892
Expected behavior. Flake8 linting works for python file. Steps to reproduce: pipenv --python 3.6 shell; code .
Read more >
Error / Violation Codes — flake8 6.0.0 documentation
Most plugins will list their error codes in their documentation or README. ... 'from module import *' used; unable to detect undefined names....
Read more >
flake8 Documentation - Read the Docs
If you only want to see the instances of a specific warning or error, you can select that error like so: flake8 --select...
Read more >
Code linting with Flake8 - Zaleos Blog
Let's start from an easier case, imagine, we are starting a new Python project. The simplest version of a script that runs this...
Read more >
How to use flake8 as unittest case? - python - Stack Overflow
Unit test should allow "ugly" code as you're only testing functionality. – ljmc. Jun 6 at 19:53. Add a comment ...
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