Bug 19545 - python2 flake8 does not run (DistributionNotFound)
Summary: python2 flake8 does not run (DistributionNotFound)
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Release (media or process) (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: Dimitrios Glentadakis
QA Contact:
URL:
Whiteboard:
Keywords: Junior_job
Depends on:
Blocks:
 
Reported: 2016-10-06 08:54 CEST by Rémi Verschelde
Modified: 2016-10-07 08:23 CEST (History)
4 users (show)

See Also:
Source RPM: python-flake8-2.5.4-2.mga6
CVE:
Status comment:


Attachments
Enki settings - detection of flake8 (67.83 KB, image/png)
2016-10-06 18:25 CEST, Dimitrios Glentadakis
Details

Description Rémi Verschelde 2016-10-06 08:54:04 CEST
Installed `python-flake8` on current Cauldron:

(media « Core Release »)
  python-flake8                  2.5.4        2.mga6        noarch  
  python-pep8                    1.7.0        1.mga6        noarch  
  python-pyflakes                1.0.0        1.mga6        noarch 

When running:

$ flake8
Traceback (most recent call last):
  File "/bin/flake8", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3140, in <module>
    @_call_aside
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3126, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3153, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 640, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 941, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 828, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'flake8==2.5.4' distribution was not found and is required by the application
Comment 1 Rémi Verschelde 2016-10-06 08:54:58 CEST
The issue seems to be that /usr/bin/flake8 wants the python3 module instead of the python2 one.
Comment 2 Rémi Verschelde 2016-10-06 09:00:11 CEST
It would also be worth upgrading to 3.0.4. A solution to the above issue would be to rename the python2 /usr/bin/flake8 before installing the python3 flavour, or reciprocally. Or decide to package only the latter.
Rémi Verschelde 2016-10-06 09:00:32 CEST

Summary: flake8 does not run (DistributionNotFound) => python2 flake8 does not run (DistributionNotFound)

Rémi Verschelde 2016-10-06 09:01:20 CEST

Keywords: (none) => Junior_job
CC: (none) => pkg-bugs

Comment 3 Charles Edwards 2016-10-06 09:20:32 CEST
We build flake8 for both python3 and python2.7
 
If you have installed flake8 on a particular version of Python (or on several versions), it may be best to run python<version> -m flake8.

for 2.7 use
$ python2.7 -m flake8

for 3 use
$ python3 -m flake8

CC: (none) => cae

Comment 4 David GEIGER 2016-10-06 12:59:53 CEST
Should be fixed in next python-flake8 update renaming flake8 binary to python3-flake8 in the python3 subpackage.

CC: (none) => geiger.david68210

Comment 5 Dimitrios Glentadakis 2016-10-06 18:25:07 CEST
Created attachment 8503 [details]
Enki settings - detection of flake8
Comment 6 Dimitrios Glentadakis 2016-10-06 18:26:21 CEST
Thanks David, i have no Cauldron installation actually, could you please test that enki finds flake8 as in the screenshot?
Comment 7 David GEIGER 2016-10-06 19:26:53 CEST
Hmmm! did not think about it :)

So I have let the python3-flake8 package use the default name "flake8" in /usr/bin/ as it is the only one who needs really this binary and rename the python2 binary to "python2-flake8".
Comment 8 Rémi Verschelde 2016-10-06 19:48:20 CEST
Yay for python3 having the priority in $PATH :D
Comment 9 David GEIGER 2016-10-07 08:23:02 CEST
Fixed!

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.