zeromq / pyzmq

PyZMQ: Python bindings for zeromq
http://zguide.zeromq.org/py:all
BSD 3-Clause "New" or "Revised" License
3.66k stars 638 forks source link

BUG: Older versions of setuptools no longer work #1896

Closed nalt closed 7 months ago

nalt commented 1 year ago

What pyzmq version?

25.1.1

What libzmq version?

Not relevant

Python version (and how it was installed)

3.8.10 via Ubuntu

OS

Ubuntu 20.04

What happened?

Version 25.1.1 no longer installs with older version of setuptools, e.g. setuptools==41.0.0:

    File "setup.py", line 39, in <module>
      from setuptools.errors import OptionError
  ModuleNotFoundError: No module named 'setuptools.errors'

This was introduced in https://github.com/zeromq/pyzmq/commit/8292503e760b352f616b2bb2f74ba2e05cde2825. Version 25.1.0 still works with setuptools==41.0.0.

A minimal version requirement should be added.

Code to reproduce bug

pip3 install setuptools==41
git clone https://github.com/zeromq/pyzmq.git .
git checkout v25.1.1
python3 setup.py install

Traceback, if applicable

No response

More info

No response

minrk commented 1 year ago

This is fixed in #1884, making the build dependency on setuptools>=61 explicit. The version requirement in 25.1.1 ought to be >=59.

nalt commented 1 year ago

Anyone with an old version of setuptools still gets 25.1.1, which will then fail.

Can the 25.1.1 version be yanked to avoid that?

minrk commented 1 year ago

I don't think it should be yanked, but I will publish a 25.1.2 with the version bound, though.

minrk commented 1 year ago

Anyone with an old version of setuptools still gets 25.1.1

This is also not true most of the time, because any standard install will get the latest setuptools during build:

python3 -m venv test-pyzmq
source test-setuptools/bin/activate
pip install setuptools==58.*
pip install --no-cache --no-binary pyzmq pyzmq

gives:

Using pip 23.2.1 from /Users/minrk/env/test-pyzmq/lib/python3.11/site-packages/pip (python 3.11)
Collecting pyzmq
  Downloading pyzmq-25.1.1.tar.gz (1.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 31.8 MB/s eta 0:00:00
  Running command pip subprocess to install build dependencies
  Ignoring cffi: markers 'implementation_name == "pypy"' don't match your environment
  Ignoring cython: markers 'implementation_name == "cpython" and python_version >= "3.12"' don't match your environment
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/4f/ab/0bcfebdfc3bfa8554b2b2c97a555569c4c1ebc74ea288741ea8326c51906/setuptools-68.1.2-py3-none-any.whl.metadata
    Downloading setuptools-68.1.2-py3-none-any.whl.metadata (6.2 kB)
  Collecting setuptools_scm[toml]
    Downloading setuptools_scm-7.1.0-py3-none-any.whl (43 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.8/43.8 kB 3.3 MB/s eta 0:00:00
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl.metadata
    Downloading wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB)
  Collecting packaging
    Downloading packaging-23.1-py3-none-any.whl (48 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 6.0 MB/s eta 0:00:00
  Collecting cython>=0.29
    Obtaining dependency information for cython>=0.29 from https://files.pythonhosted.org/packages/03/e9/9cc0c4f0d8a566089d096254cd25168a0db02dd047863a7f995d8d3eefa7/Cython-3.0.2-py2.py3-none-any.whl.metadata
    Downloading Cython-3.0.2-py2.py3-none-any.whl.metadata (3.1 kB)
  Collecting typing-extensions (from setuptools_scm[toml])
    Obtaining dependency information for typing-extensions from https://files.pythonhosted.org/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl.metadata
    Downloading typing_extensions-4.7.1-py3-none-any.whl.metadata (3.1 kB)
  Downloading setuptools-68.1.2-py3-none-any.whl (805 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 805.1/805.1 kB 24.4 MB/s eta 0:00:00
  Downloading wheel-0.41.2-py3-none-any.whl (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.8/64.8 kB 5.5 MB/s eta 0:00:00
  Downloading Cython-3.0.2-py2.py3-none-any.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 31.8 MB/s eta 0:00:00
  Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB)
  Installing collected packages: wheel, typing-extensions, setuptools, packaging, cython, setuptools_scm
  Successfully installed cython-3.0.2 packaging-23.1 setuptools-68.1.2 setuptools_scm-7.1.0 typing-extensions-4.7.1 wheel-0.41.2
  Installing build dependencies ... done
...

so the vast majority of installs will either

  1. get a wheel, or
  2. build from source, in which case the latest setuptools will be downloaded, not an outdated version

neither of which encounter any errors. The same goes for the documented "install from source", which should use pip install ., not the deprecated and discouraged (throughout all Python packaging, not just pyzmq) direct invocation of setup.py install that encounter any errors, which would also ignore the version specification in pyproject.toml, anyway.

nalt commented 1 year ago

If there is another package in your software project that needs an older setuptools, pip would keep that version. In larger projects there are many version requirements, so it would be nice if version resolving works reliably.

But you are right, it only appears in special situations.

minrk commented 1 year ago

Can you point to a concrete example? I might be missing something, because there really are so many ways to install packages. Since pip's standard behavior is isolated environments for each package, pyzmq's build dependencies shouldn't be related to any other package in your environment. The dependency is only shared across packages if each package's build environment is ignored (e.g. --no-build-isolation), in which case expressing an explicit build dependency on setuptools>=59 won't solve anything because that pin is still ignored. It becomes an only "for humans" dependency communication.

minrk commented 7 months ago

Build dosen't use any version of setuptools anymore.