sublimetext3flake8sublimelinter

How can I fix this issue with SublimeLinter?


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.


Solution

  • 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?