Opened 10 years ago

Closed 9 years ago

#47429 closed defect (fixed)

py-flake8, py-pep8: current versions not compatible

Reported by: rectalogic (Andrew Wason) Owned by: petrrr
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: patrik.hartlen@…, madasi@…
Port: py-flake8 py-pep8

Description

py27-flake8 @2.4.0_0 installs py27-pep8 @1.6.2_0 but is not compatible with it and fails to start:

$ flake8
Traceback (most recent call last):
  File "/opt/local/bin/flake8", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3057, in <module>
    working_set = WorkingSet._build_master()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 641, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 654, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 827, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pep8<1.6,>=1.5.7' distribution was not found and is required by flake8

To make flake8 work you have to force downgrade py27-pep8 to @1.5.7_0

flake8 2.4.0 introduced version caps on pep8, it requires an older version of pep8 https://gitlab.com/pycqa/flake8/issues/35

Change History (11)

comment:1 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to petr@…
Port: py-flake8 added; py27-flake8 removed

In the future, please Cc the port maintainers (port info --maintainers py27-flake8), if any.

comment:2 Changed 10 years ago by petrrr

Cc: patrik.hartlen@… added
Port: py-pep8 added
Summary: py27-flake8 not compatible with current py27-pep8py-flake8, py-pep8: current versions not compatible
Version: 2.3.3

This is a reciprocal incompatibility introduced upstream, therefore I add the maintainer of py-pep8.

There is no single correct solution, to this issue. Either you would downgrade py-pep8 (if you need the most recent py-flake8 version) or you would downgrade py-flake8 (if you need the latest py-pep8 features). So I'd propose to leave the ports in the current state, in the hope the conflict is resolves soon upstream. Users can go install older versions of the port.

The following combinations should work:

  • py-pep8 @1.6.2 with py-flake8 @ 2.3.0 or
  • py-pep8 @1.5.7 with py-flake8 @2.4.0
Last edited 10 years ago by petrrr (previous) (diff)

comment:3 Changed 10 years ago by seanfarley (Sean Farley)

I also ran into this issue. It is extremely annoying when this situation happens. I offer no real help here, just complaining :-)

comment:4 Changed 9 years ago by petrrr

py-flake8 added an other constrain on its dependencies: pyflakes<0.9,>=0.8.1.

comment:5 Changed 9 years ago by petrrr

The pyflakes dependency conflict should be resolved by r138126.

comment:6 Changed 9 years ago by petrrr

To solve this issue completely, this commit would be required: https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21

I'd propose to wait some days to see if there will be an upstream release any soon. Otherwise we could patch py-pep8 accordingly and remove the version constraint.

comment:7 Changed 9 years ago by jacoblee@…

Adding this to this ticket, since it is not resolved, and the issue is similar. On a relatively clean install:

sudo port install py27-flake8

Installed:

  flake8_select @0.1_0 
  py27-flake8 @2.4.1_0 
  py27-flake8-mccabe @0.3.1_0 
  py27-pyflakes @0.9.2_0 
  pyflakes_select @0.1_0 
  pep8_select @0.1_0 
  py27-pep8 @1.6.2_0 
  py27-flake8-mccabe @0.3.1_0

Found, that I had to call port select --set on the flake8 dependencies, pyflakes and pep8. I was surprised, but maybe that is not so unusual.

When trying to call flake8 I get the following traceback:

Traceback (most recent call last):
  File "/opt/local/bin/flake8", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3084, in <module>
    @_call_aside
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3070, in _call_aside
    f(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 653, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 839, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pep8!=1.6.0,!=1.6.1,!=1.6.2,>=1.5.7' distribution was not found and is required by flake8

Oddly, my version of pep8 is 1.6.2 which is one of those listed in the error message.

Here is the list of site-packages in my macports python site-packages directory.

$ ls -1 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/README
_markerlib
easy_install.py
easy_install.pyc
flake8
flake8-2.4.1-py2.7.egg-info
mccabe-0.3.1-py2.7.egg-info
mccabe.py
mccabe.pyc
pep8-1.6.2-py2.7.egg-info
pep8.py
pep8.pyc
pip
pip-7.1.0-py2.7.egg-info
pkg_resources
pyflakes
pyflakes-0.9.2-py2.7.egg-info
setuptools
setuptools-18.0.1-py2.7.egg-info

comment:8 in reply to:  7 Changed 9 years ago by petrrr

Replying to jacoblee@…:

Adding this to this ticket, since it is not resolved, and the issue is similar.

Yes, the ticket is about this issue.

[...]

On a relatively clean install:

sudo port install py27-flake8

[...]

Your installation work *as expected*.

Found, that I had to call port select --set on the flake8 dependencies, pyflakes and pep8. I was surprised, but maybe that is not so unusual.

I an not sure if I understand this correctly.

Macports installs the callable scripts with a -2.7 and -3.4 suffix, respectively to allow the installation against various versions of Python. Appending this suffix allows you to select the desired version. With port select you can choose your default version.

However, it should not be really necessary to perform a port select --set to have this package working correctly. If you found this necessary to make the packages working correctly, this is probably a bug and needs fixing.

When trying to call flake8 I get the following traceback:

Traceback (most recent call last):
  File "/opt/local/bin/flake8", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3084, in <module>
    @_call_aside
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3070, in _call_aside
    f(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 653, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 839, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pep8!=1.6.0,!=1.6.1,!=1.6.2,>=1.5.7' distribution was not found and is required by flake8

Oddly, my version of pep8 is 1.6.2 which is one of those listed in the error message.

Yes, this is exactly the issue here. The most recent released versions of pep8 and flake8 are not compatible, so this combination fails. This would ideally be solve upstream, but to my surprise this takes quite some time and the developers have not released yet.

To have an immediate work-around you could install version 1.5.8. See wiki:howto/InstallingOlderPort.

If we consider not to wait for upstream, we would need to:

  • down-grade pep8 to 1.5.8 again;
  • upgrade an unreleased *post-1.6.2-version* from the repository `435d1cb`;

comment:9 Changed 9 years ago by madasi@…

Cc: madasi@… added

Cc Me!

comment:10 Changed 9 years ago by petrrr

r141247 introduces an new port py-pep8-157, r141248 updates py-flake8 to use this new port as dependency.

This should fix the problem, but will require do deactivate py-pep8.

comment:11 Changed 9 years ago by petrrr

Resolution: fixed
Status: newclosed

r141250 and r141319 add (correct) deactivate hack. So this should be fixed, and has a smooth path to be effective. Uses still can use pep @1.6.2 if they do not need flake8 and prefer a newer version.

Note: See TracTickets for help on using tickets.