vim-flake8 is not working
Asked Answered
A

6

19

I installed vim-flake8 by git cloning it on my Pathogen bundle folder as usual, but when I tried to run the plugin pressing F7 or using :call Flake8() in one Python file I receive the following message:

Error detected while processing function Flake8:

line 8:

File flake8 not found. Please install it first.

Anyone has some clue about what is going on ?

Archery answered 11/6, 2013 at 14:19 Comment(0)
S
24

The error message is telling you that you didn't install the program flake8. Install it.

Assuming pip is installed

pip install flake8

should work.

Schumer answered 11/6, 2013 at 14:33 Comment(3)
Hi, Can somebody explain me why this solution doesn't work for me but installing flake from the apt repository it works?Voluptuary
@AbyW Maybe python 3 vs python 2 issue?Schumer
Actually you code worked and installed flake8. But When I tried to use Vim with vim-flake8 plug didn't work.Voluptuary
M
7

If installing flake8 via pip is not working try this:

apt-get install flake8

Worked for me.

Mureil answered 25/11, 2015 at 15:37 Comment(1)
hmm. I previously installed just python-flake8, and that didn't work by itself, but its a dependency for flake8 (according to apt-cache show flake8). Now its working (WSL, Debian, vim)Cahier
K
4

If you installed flake8 already and that error occurred still, then call flake8 using absolute path.

To do this, edit line 73 of ~/.vim/autoload/flake8.vim as following:

call s:DeclareOption('flake8_cmd', '', '"/absolute/path/to/flake8"')

Kiker answered 27/1, 2015 at 2:46 Comment(0)
D
4
pip install flake8

and if you run into permission errors:

sudo -H pip install flake8
Dowager answered 24/7, 2015 at 16:33 Comment(0)
H
1

If you are on OSX and you're still having this problem, this solved it for me. Just run the following command in your terminal.

ln -s ~/.vim/bundle/vim-flake8/plugin ~/.vim/bundle/vim-flake8/ftplugin

And I haven't tried this solution yet, but apparently you can just add filetype plugin on to your .vimrc and it should work.

Hairbreadth answered 7/7, 2016 at 22:5 Comment(0)
P
1

Add to your .vimrc

let g:flake8_cmd = '/path/to/flake8'

That implies, of course, you have installed flake8 on your computer. I have installed it using pip3 on Mac OS X, it wasn't in the path, the plugin threw an exception, and Google brought me here. The variable was added back in 2012 already

Piave answered 1/12, 2019 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.