zope.interface
zope.interface copied to clipboard
Pip install zope.interface need the lateset setuptools (60.5.0), which can't work with python 2.7
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
The zope.interface installation would use the latest setuptools , that's not good, because the latest setuptools can't work with python 2.7 .
Could anyone tell me how to install zope.interface 44.2 on python 2.7 ?
Thanks
What I did:
pip install twisted==20.3.0 # The lastest can't work on python2.7, 20.3.0 can
What I expect to happen:
Together install some other packages , work fine with python2.7
What actually happened:
` Collecting zope.interface>=4.4.2 (from Twisted===20.3.0) Collecting setuptools (from zope.interface>=4.4.2->Twisted==18.4.0) Downloading setuptools-60.5.0.tar.gz
AttributeError: DistutilsMetaFinder instance has no attribute 'find_module' `
What version of Python and Zope/Addons I am using:
Ubuntu 16.04 server rtt python 2.7 ROS kinetic pip 8.11
wei1224hf wrote at 2022-1-17 00:34 -0800:
The zope.interface installation would use the latest setuptools ... ... pip install twisted==20.3.0 # The lastest can't work on python2.7, 20.3.0 can `
What I expect to happen:
Together install some other packages , work fine with python2.7
What actually happened:
` Collecting zope.interface>=4.4.2 (from Twisted===20.3.0) Collecting setuptools (from zope.interface>=4.4.2->Twisted==18.4.0) Downloading setuptools-60.5.0.tar.gz
AttributeError: DistutilsMetaFinder instance has no attribute 'find_module'
That a new setuptools version is downloaded does not seem
to be a zope.interface problem:
I looked at the install_requires in the setup.py of zope.interface
(master); it mentions setuptools but without any version specification.
Thus, it should work with any setuptools version already present.
Please try either of the following:
- install a Python 2.7 compatible
setuptoolsversion before you try to installtwisted - use
pip installwith a requirements or contraints file specifying the versions working in your case.
We could work around the Python 2.7 problems of modern setuptools versions
by specifying a sufficiently old setuptools version in
zope.interface's install_requires. BUT this likely
would compromise many new installations.
We could make the setuptools version dependent of Python 2 versus Python 3,
BUT this would work only for the source distribution:
to my knowledge, the eggs and wheel format is not versatile enough to
support Python version dependent install_requires.
zope.interface==4.4.2 is old. I expect that its users must
solve setuptools problems on their own (see above).
We could make the
setuptoolsversion dependent of Python 2 versus Python 3, BUT this would work only for the source distribution: to my knowledge, the eggs and wheel format is not versatile enough to support Python version dependentinstall_requires.
I think this is incorrect. You can write something like install_requires=["setuptools; python_version>='3'", "setuptools<45; python_version<'3'"] and that should work fine with wheels - it ends up in the wheel's METADATA file and pip understands it.
However, there's the question of whether zope.interface should be declaring setuptools in install_requires at all. It's only used in setup.py, so it should probably be in setup_requires instead. There may be some historical thorniness here, but still ...
pkg_resources as part of setuptools and is used for legacy namespace declaration here:
https://github.com/zopefoundation/zope.interface/blob/master/src/zope/init.py#L1
I am confused with the multiple ways of namespace declarations and why/when legacy needs to be used. Switching to PEP420 Style namespaces would remove any runtime dependency on setuptools.
Ah, I'd missed the use of pkg_resources.
As far as I know there isn't a sensible way to migrate from the pkg_resources namespace approach to PEP420, because all zope.* packages would have to be migrated simultaneously. PyPA says that trying to migrate is not advisable.
Colin Watson wrote at 2022-1-17 03:39 -0800:
However, there's the question of whether
zope.interfaceshould be declaringsetuptoolsininstall_requiresat all. It's only used insetup.py, so it should probably be insetup_requiresinstead. There may be some historical thorniness here, but still ...
I used to add setuptools in my packages to make zc.buildout happy.
Otherwise, it complained "uses namespace packages but does not depend
on setuptools".
setuptools defines requires_python and so pip should only download a compatible version, it seems like upgrading pip in your 2.7 environment should fix this issue