PyCQA / pycodestyle

Simple Python style checker in one Python file
https://pycodestyle.pycqa.org
Other
5.01k stars 755 forks source link

ModuleNotFoundError: No module named 'flake8.plugins.pycodestyle' #1210

Closed giovannicemin closed 9 months ago

giovannicemin commented 9 months ago

The error has occurred while using pyright.

Current versions: flake8=6.1.0 pycodestyle=2.11.1

Full traceback: Traceback (most recent call last): File "/home/user/anaconda3/envs/noise_models/bin/flake8", line 10, in sys.exit(main()) File "/home/user/.local/lib/python3.9/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/user/.local/lib/python3.9/site-packages/flake8/main/application.py", line 363, in run self._run(argv) File "/home/user/.local/lib/python3.9/site-packages/flake8/main/application.py", line 350, in _run self.initialize(argv) File "/home/user/.local/lib/python3.9/site-packages/flake8/main/application.py", line 330, in initialize self.find_plugins(config_finder) File "/home/user/.local/lib/python3.9/site-packages/flake8/main/application.py", line 159, in find_plugins self.check_plugins.load_plugins() File "/home/user/.local/lib/python3.9/site-packages/flake8/plugins/manager.py", line 415, in load_plugins plugins = list(self.manager.map(load_plugin)) File "/home/user/.local/lib/python3.9/site-packages/flake8/plugins/manager.py", line 302, in map yield func(self.plugins[name], *args, **kwargs) File "/home/user/.local/lib/python3.9/site-packages/flake8/plugins/manager.py", line 413, in load_plugin return plugin.load_plugin() File "/home/user/.local/lib/python3.9/site-packages/flake8/plugins/manager.py", line 164, in load_plugin raise failed_to_load flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "E" due to No module named 'flake8.plugins.pycodestyle'.

Try installing a more recent version of python-flake8, and please open a bug report if the issue persists in the latest release. Thanks!

asottile commented 9 months ago

you have two separate versions of flake8 installed and they are conflicting with each other -- I'd recommend using a virtualenv

giovannicemin commented 9 months ago

Thank you for the quick answer! That solved the problem :)