Search code examples
pythonpipatom-editorflake8linter

Installing Packages on ATOM for python (linter and autopep8)


I am trying to set up my environment for ATOM for python. I did this on my previous PC and didn't run into much trouble but this time I believe something is messed up and I don't know how to fix it.

Linter-flake8 installation:

I installed it by doing this:

settings --> install --> search packages --> linter-flake8 --> install. 

Dependencies were installed afterward automatically.

then I ran the CMD and installed flake8 using:

py -m pip install flake8

When I try typing my code into ATOM; I get this error:

[Linter] Error running Flake8 Error: Failed to spawn command `flake8`. Make sure `flake8` is installed and on your PATH
at C:\Users\yazan\.atom…\lib\helpers.js:130
(anonymous) @   C:\Users\yazan\.atom…ter\dist\index.js:1

Things I tried to fix this:

  1. Adding ATOM to my path, which I did but did not work (ATOM and Python both are in my user and system, environment variables)
  2. Checking that my ATOM is running the same version of python.
import sys
print(sys.version)
3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
  1. Checked installation path for my linter-flake8 in CMD:

result -->

C:\Users\yazan>py -m pip install flake8
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: flake8 in c:\users\yazan\appdata\roaming\python\python39\site-packages (3.9.2)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in 
c:\users\yazan\appdata\roaming\python\python39\site-packages (from flake8) (0.6.1)
Requirement already satisfied: pyflakes<2.4.0,>=2.3.0 in 
c:\users\yazan\appdata\roaming\python\python39\site-packages (from flake8) (2.3.1)
Requirement already satisfied: pycodestyle<2.8.0,>=2.7.0 in 
c:\users\yazan\appdata\roaming\python\python39\site-packages (from flake8) (2.7.0)

I am running out of ideas and searched a lot but could not figure out how to fix this.

Thanks!


Solution

  • As mentioned in the linter-flake8 README, you can set the executablePath in the package settings. This should help you get around Atom's flaky support for environment variables.

    enter image description here