Closed adamkrawczyk closed 1 year ago
Ubuntu Jammy packages python3-flake8
4.0.1. The flake8
version you have installed using pip (6.0.0) is not yet supported. Please uninstall the package from pip and use the version supplied with the distribution.
I was having a similar issue but doing what you described and using the version supplied with the distribution (python3-flake8 4.0.1) was not working. it was giving this error whenever i tried using ament-flake8.
attributeerror: module 'pycodestyle' has no attribute 'missing_whitespace_after_import_keyword'. Did you mean: 'missing_whitespace_after_keyword'?
I found that downgrading python3-flake8 to 4.0.0 fixed the problem for me. But I am not sure why. Maybe related to the included pycodestyle version.
I was having a similar issue but doing what you described and using the version supplied with the distribution (python3-flake8 4.0.1) was not working. it was giving this error whenever i tried using ament-flake8.
The same happens to me :(
Ubuntu Jammy packages
python3-flake8
4.0.1. Theflake8
version you have installed using pip (6.0.0) is not yet supported. Please uninstall the package from pip and use the version supplied with the distribution.
How do you uninstall it? I tried a few options. Looks like the one it wants to uninstall is v4. The versions I have in debian are supposedly all compatible.
friedman@AutonomyML01:~/Development/ros2$ python3 -m pip uninstall flake8
Found existing installation: flake8 4.0.1
Uninstalling flake8-4.0.1:
Would remove:
/usr/lib/python3/dist-packages/flake8
/usr/lib/python3/dist-packages/flake8-4.0.1.egg-info
Proceed (Y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/shutil.py", line 816, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/flake8' -> '/tmp/pip-uninstall-v7u8durw'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/commands/uninstall.py", line 105, in run
uninstall_pathset = req.uninstall(
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 725, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 381, in remove
moved.stash(path)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 272, in stash
renames(path, new_path)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 362, in renames
shutil.move(old, new)
File "/usr/lib/python3.10/shutil.py", line 834, in move
rmtree(src)
File "/usr/lib/python3.10/shutil.py", line 725, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'exceptions.py'
friedman@AutonomyML01:~/Development/ros2$ python3 -m pip uninstall flake8
Found existing installation: flake8 4.0.1
Uninstalling flake8-4.0.1:
Would remove:
/usr/lib/python3/dist-packages/flake8
/usr/lib/python3/dist-packages/flake8-4.0.1.egg-info
Proceed (Y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/shutil.py", line 816, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/flake8' -> '/tmp/pip-uninstall-a_2lk6o1'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/commands/uninstall.py", line 105, in run
uninstall_pathset = req.uninstall(
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 725, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 381, in remove
moved.stash(path)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/req/req_uninstall.py", line 272, in stash
renames(path, new_path)
File "/home/friedman/.local/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 362, in renames
shutil.move(old, new)
File "/usr/lib/python3.10/shutil.py", line 834, in move
rmtree(src)
File "/usr/lib/python3.10/shutil.py", line 725, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'exceptions.py'
friedman@AutonomyML01:~/Development/ros2$ which flake8
friedman@AutonomyML01:~/Development/ros2$ flake8
Command 'flake8' not found, but can be installed with:
sudo apt install flake8
friedman@AutonomyML01:~/Development/ros2$ ament_flake8
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flake8/plugins/manager.py", line 161, in load_plugin
self._load()
File "/usr/lib/python3/dist-packages/flake8/plugins/manager.py", line 138, in _load
self._plugin = self.entry_point.load()
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 173, in load
return functools.reduce(getattr, attrs, module)
AttributeError: module 'pycodestyle' has no attribute 'missing_whitespace_after_import_keyword'. Did you mean: 'missing_whitespace_after_keyword'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/ros/humble/bin/ament_flake8", line 33, in <module>
sys.exit(load_entry_point('ament-flake8==0.12.9', 'console_scripts', 'ament_flake8')())
File "/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py", line 31, in main
rc, _ = main_with_errors(argv=argv)
File "/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py", line 88, in main_with_errors
report = generate_flake8_report(
File "/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py", line 248, in generate_flake8_report
style = get_flake8_style_guide(flake8_argv)
File "/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py", line 156, in get_flake8_style_guide
application.find_plugins(config_finder)
File "/usr/lib/python3/dist-packages/flake8/main/application.py", line 163, in find_plugins
self.check_plugins.load_plugins()
File "/usr/lib/python3/dist-packages/flake8/plugins/manager.py", line 422, in load_plugins
plugins = list(self.manager.map(load_plugin))
File "/usr/lib/python3/dist-packages/flake8/plugins/manager.py", line 309, in map
yield func(self.plugins[name], *args, **kwargs)
File "/usr/lib/python3/dist-packages/flake8/plugins/manager.py", line 420, in load_plugin
return plugin.load_plugin()
File "/usr/lib/python3/dist-packages/flake8/plugins/manager.py", line 168, in load_plugin
raise failed_to_load
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "pycodestyle.missing_whitespace_after_import_keyword" due to module 'pycodestyle' has no attribute 'missing_whitespace_after_import_keyword'.
$ python3 -m pip show flake8
Name: flake8
Version: 4.0.1
Summary: the modular source code checker: pep8 pyflakes and co
Home-page: https://github.com/pycqa/flake8
Author: Tarek Ziade
Author-email: tarek@ziade.org
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:
Required-by:
$ sudo apt install ros-humble-ament-flake8
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ros-humble-ament-flake8 is already the newest version (0.12.9-1jammy.20231117.163433).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
friedman@AutonomyML01:~/Development/ros2$ sudo apt show python3-pycodestyle
Package: python3-pycodestyle
Version: 2.8.0-2
Priority: optional
Section: universe/python
Source: pycodestyle
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Python Team <team+python@tracker.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 159 kB
Depends: python3:any
Breaks: python3-flake8 (<< 4.0.1-1~)
Homepage: https://github.com/PyCQA/pycodestyle
Download-Size: 39.2 kB
APT-Manual-Installed: no
APT-Sources: http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
Description: Python style guide checker (formerly called pep8) - Python 3.x
Features a plugin architecture allowing for adding new checks is easily.
Parseable output listing line numbers of the error location. Consists of
just one Python file, and requires only stdlib.
.
This package contains the Python 3.x module.
friedman@AutonomyML01:~/Development/ros2$ sudo apt info python3-flake8
Package: python3-flake8
Version: 4.0.1-2
Priority: optional
Section: universe/python
Source: python-flake8
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Python Team <team+python@tracker.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 259 kB
Depends: python3-mccabe, python3-pycodestyle (>= 2.8.0), python3-pyflakes (>= 2.4.0), python3-setuptools, python3-importlib-metadata | python3 (>> 3.8), python3:any
Breaks: python3-flake8-polyfill (<< 1.0.2-3~), python3-pytest-flake8 (<< 1.0.6-4~)
Homepage: https://gitlab.com/pycqa/flake8
Download-Size: 49.8 kB
APT-Manual-Installed: yes
APT-Sources: http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
Description: code checker using pycodestyle and pyflakes - Python 3.x
Flake8 is a wrapper around PyFlakes, pycodestyle, and Ned's McCabe script.
Flake8 runs all tools by launching the single 'flake8' script, but ignores
pycodestyle and PyFlakes extended options and just uses defaults. It displays
the warnings in a per-file, merged output.
.
This package provides Python 3 module bindings only.
Hi,
There is a problem with the ament_flake8 package, I haven't had time to investigate this, sorry for that. Colcon test is of course affected as well. I should have everything up to date.
Here is the log.