Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs Flycheck "Configured syntax checker python-flake8 cannot be used"

New emacs/python user here.
I'm trying to set up flycheck to work (and use flake8).

This is the relevant part in my init.el:

(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
(add-hook 'python-mode-hook 'flycheck-mode)

When I open a python file my modeline includes Py FlyC-
From the Flycheck manual I learned that this means Flycheck could not automatically find a suitable checker.

When I run M-x flycheck-select-checker and select python-flake8 it returns:

Configured syntax checker python-flake8 cannot be used

I'm using OSX 10.9 with homebrew and these versions:

$ emacs --version
GNU Emacs 24.3.50.1
$ flake8 --version
2.1.0 (pep8: 1.4.6, pyflakes: 0.7.3, mccabe: 0.2.1) CPython 2.7.5 on Darwin
$ which flake8
/usr/local/bin/flake8
$ python --version
Python 2.7.5
$ which python
/usr/local/bin/python

As for the emacs packages, they are installed from melpa and marmalade

python-mode version: 6.0.10
Flycheck version: 0.15snapshot (package: 20131105.1502)

Any hints on how to get this working?

like image 989
jeroentbt Avatar asked Nov 06 '13 02:11

jeroentbt


1 Answers

Do M-: (executable-find "flake8"). If it says nil, add /usr/local/bin to your exec-path.

On OS X GUI applications do not inherit variables from the shell configuration and thus have a different $PATH. Hence, being able to run flake8 in the terminal doesn't imply, that Emacs is able to find it as well.

You may also want to look at the exec-path-from-shell package.

like image 165
lunaryorn Avatar answered Sep 21 '22 06:09

lunaryorn