2

I hope it is ok to ask this even though it is not specifically a programming question. I installed the SublimeLinter and SublimeLinter-flake8 packages in Sublime Text 3. I did pip install flake8 and restarted but the console shows the following message:

SublimeLinter: WARNING: cannot locate 'flake8'. Fill in the 'python' or 'executable' setting. WARNING:SublimeLinter.lint.base_linter.python_linter:cannot locate 'flake8'.Fill in the 'python' or 'executable' setting

I suspect it may have to do with setting a path in the user settings, but I am not sure how to go about it. As you may see I am a relative newbie. Thanks.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • [This should help you](https://github.com/SublimeLinter/SublimeLinter/issues/1462) – 0stone0 May 08 '20 at 22:32
  • @0stone0 feel free to post an answer. That thread is kind of convoluted, so a simple, straightforward explanation of the fix would be appropriate here. Be sure to reference the original link. – MattDMo May 10 '20 at 22:54

1 Answers1

10

Please ensure you've followed these steps:

  1. Install SublimeText packages (help)

    • SublimeLinter
    • SublimeLinter-flake8
  2. Install Flake8 (use pip, or pip3 if you have multiple python versions)

    • pip3 install flake8
  3. Configure flake8 settings
    1. Open Sublime Text
    2. Sublime Text -> Preferences -> Package Settings -> Sublime Linter -> Settings
    3. Set the path to the desired python version:

Notice: Custom settings needs to be on the right(user) side!

{
    "linters": {
        "flake8": {
            "executable": [ "python3", "-m", "flake8" ]
        }
    }
}

Restart Sublime to enable the changes

enter image description here

Not sure about pip or pip3? Please take a look at pip or pip3 to install packages for Python 3?

0stone0
  • 34,288
  • 4
  • 39
  • 64
  • 3
    You can also put this in your .sublime-project file: `{"settings": {"SublimeLinter.linters.flake8.executable": ["python", "-m", "flake8"]}}` – John Berberich Feb 04 '22 at 18:31