Jonatas Eduardo
Jonatas Eduardo

Reputation: 685

vim-flake8 is not working

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 ?

Upvotes: 19

Views: 11801

Answers (6)

badbishop
badbishop

Reputation: 1668

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

Upvotes: 1

TomKivy
TomKivy

Reputation: 408

pip install flake8

and if you run into permission errors:

sudo -H pip install flake8

Upvotes: 4

Alex Cory
Alex Cory

Reputation: 11885

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.

Upvotes: 1

Kacper Wikieł
Kacper Wikieł

Reputation: 260

If installing flake8 via pip is not working try this:

apt-get install flake8

Worked for me.

Upvotes: 7

FDinoff
FDinoff

Reputation: 31469

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.

Upvotes: 24

Yukino Ikegami
Yukino Ikegami

Reputation: 139

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"')

Upvotes: 4

Related Questions