Repository navigation
Detection of flake8 is inconsitent/broken in some cases #1892
Copy link
Copy link
Closed
Labels
area-lintingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
Description
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:
pipenv --python 3.6 shellcode .pipenv install flake8 --dev- 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 (View→Output, 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-lintingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
Activity
[-]Detection of flake8 extension is inconsitent/broken in some cases[/-][+]Detection of flake8 is inconsitent/broken in some cases[/+]DonJayamanne commentedon Jun 7, 2018
Rather than activating python in the Shell and then opening vscode, please configure the path to the python executable in
settings.jsonin thepython.pythonPathsetting.See here https://code.visualstudio.com/docs/python/environments#_how-to-choose-an-environment
rsyring commentedon Jun 7, 2018
Don Jayamanne (@DonJayamanne) While I like my method better, and hope it's supported, I tried what you suggested and it made no difference with the issue I reported.
DonJayamanne commentedon Jun 7, 2018
Please could you provide the contents of your settings.json?
rsyring commentedon Jun 7, 2018
Obviously, flake8 being disabled in the project's settings is because it's not working and the constant notice box is annoying.
DonJayamanne commentedon 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 --versionPlease confirm you have restarted VS Code after making the changes to the
settings.jsonfile.rsyring commentedon Jun 7, 2018
Well, I had deleted and reinstalled the virtualenv so I had to re-install flake8. Once I did so, I have:
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. :o/