Skip to main content
Topic: Flake8 outdated break pyls and emacs python syntax checking (Read 706 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Flake8 outdated break pyls and emacs python syntax checking

Hello, I'm trying to solve an issue.

flake8 in artixlinux (~5.0.4) is behind version in archLinux (~6.0.0)  and is causing this problem, making software that use it complain and resulting in a flake8 failure, as below:

Code: [Select]
  File "/usr/lib/python3.10/site-packages/flake8/plugins/finder.py", line 296, in _load_plugin
    obj = plugin.entry_point.load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/flake8/plugins/pycodestyle.py", line 28, in <module>
    from pycodestyle import python_3000_backticks as _python_3000_backticks
ImportError: cannot import name 'python_3000_backticks' from 'pycodestyle' (/usr/lib/python3.10/site-packages/pycodestyle.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/flake8", line 33, in <module>
    sys.exit(load_entry_point('flake8==5.0.4', 'console_scripts', 'flake8')())
  File "/usr/lib/python3.10/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/usr/lib/python3.10/site-packages/flake8/main/application.py", line 336, in run
    self._run(argv)
  File "/usr/lib/python3.10/site-packages/flake8/main/application.py", line 324, in _run
    self.initialize(argv)
  File "/usr/lib/python3.10/site-packages/flake8/main/application.py", line 302, in initialize
    self.find_plugins(
  File "/usr/lib/python3.10/site-packages/flake8/main/application.py", line 128, in find_plugins
    self.plugins = finder.load_plugins(raw, opts)
  File "/usr/lib/python3.10/site-packages/flake8/plugins/finder.py", line 370, in load_plugins
    return _classify_plugins(_import_plugins(plugins, opts), opts)
  File "/usr/lib/python3.10/site-packages/flake8/plugins/finder.py", line 312, in _import_plugins
    return [_load_plugin(p) for p in plugins]
  File "/usr/lib/python3.10/site-packages/flake8/plugins/finder.py", line 312, in <listcomp>
    return [_load_plugin(p) for p in plugins]
  File "/usr/lib/python3.10/site-packages/flake8/plugins/finder.py", line 298, in _load_plugin
    raise FailedToLoadPlugin(plugin.package, e)
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "pycodestyle" due to cannot import name 'python_3000_backticks' from 'pycodestyle' (/usr/lib/python3.10/site-packages/pycodestyle.py).


I have forced the install of the arch Linux version, in "community", but when doing and upgrade pacamn will revert back to the artixlinux version.

How to solve this issue?

Regards

Carlo D.

Re: Flake8 outdated break pyls and emcas python syntax checking

Reply #1
Have you tried completely removing flake using pacman -Rns and then installing it again?

Re: Flake8 outdated break pyls and emcas python syntax checking

Reply #2
I have forced the install of the arch Linux version, in "community", but when doing and upgrade pacamn will revert back to the artixlinux version.
Are you saying is has reverted ? Or that you think it will  ?
Because I think it won't revert. You'll just get a warning
Quote
warning: flake8: local (6.0.0) is newer than community (5.0.4)

Eventually when the Artix version goes past version 6.0.0 you'll  be back on the Artix version.

If flake8 is working for you now I wouldn't worry.


Re: Flake8 outdated break pyls and emcas python syntax checking

Reply #3
Have you tried completely removing flake using pacman -Rns and then installing it again?

Yes it was what I've done.

I removed old flake8 and then installed it with:

Code: [Select]
pacman -S community/flake8


 

 

Re: Flake8 outdated break pyls and emcas python syntax checking

Reply #4
Are you saying is has reverted ? Or that you think it will  ?
...


It has reverted, now the error I reported is here, so you could easily see that flake8 is at version 5.0.4.

Running pacman -Rns

will remove.

Code: [Select]
python-pyflakes-3.0.1-1  flake8-1:5.0.4-2


But trying to install from community it will gave an error about PGP signatures not correct. Strange yesterday it was not happening.

Now it seems that a subsequent pacman -Syu will install autopep8 instead, so I've to configure pylsp to use this instead.

But the problem is not solved, it is only a workaround to make emacs works with pylsp not complainng about linting.