zeromq / pyzmq

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

BUG: "No module named cython" when building 26.0.0+ with Pyston 2.3.5 #1984

Closed dmrlawson closed 2 months ago

dmrlawson commented 2 months ago

This is a pyzmq bug

What pyzmq version?

26.0.0+

What libzmq version?

4.3.4

Python version (and how it was installed)

pyston-2.3.5 installed via pyenv

OS

Ubuntu 22.04

What happened?

When updating pyzmq from version 25.1.2 I got an error.

Code to reproduce bug

1. Install pyston-2.3.5 from pyenv
2. Make a virtualenv
3. Try to install pyzmq

Traceback, if applicable

(more can be provided on request)
...
  [103/109] Building CXX object _deps/bundled_libzmq-build/CMakeFiles/objects.dir/src/tipc_connecter.cpp.o
  [104/109] Building CXX object _deps/bundled_libzmq-build/CMakeFiles/objects.dir/src/udp_engine.cpp.o
  [105/109] Building CXX object _deps/bundled_libzmq-build/CMakeFiles/objects.dir/src/socket_base.cpp.o
  [106/109] Linking CXX static library _deps/bundled_libzmq-build/lib/libzmq.a
  [107/109] Generating _src/_zmq.c
  FAILED: _src/_zmq.c /tmp/tmpd9xa1398/build/_src/_zmq.c
  cd /tmp/tmpd9xa1398/build && /home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/bin/python -mcython --3str --output-file /tmp/tmpd9xa1398/build/_src/_zmq.c --module-name zmq.backend.cython._zmq /tmp/pip-install-m1z8ag2s/pyzmq_22e735db494c49e7b0d28815b1ad745c/zmq/backend/cython/_zmq.py
  /home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/bin/python: No module named cython
  ninja: build stopped: subcommand failed.

  *** CMake build failed
  error: subprocess-exited-with-error

  × Building wheel for pyzmq (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/bin/python /home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/lib/python3.8-pyston2.3/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpsj5fhcnz
  cwd: /tmp/pip-install-m1z8ag2s/pyzmq_22e735db494c49e7b0d28815b1ad745c
  Building wheel for pyzmq (pyproject.toml) ... error
  ERROR: Failed building wheel for pyzmq
Failed to build pyzmq
ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects
Exception information:
Traceback (most recent call last):
  File "/home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/lib/python3.8-pyston2.3/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
  File "/home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/lib/python3.8-pyston2.3/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
    return func(self, options, args)
  File "/home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/lib/python3.8-pyston2.3/site-packages/pip/_internal/commands/install.py", line 429, in run
    raise InstallationError(
pip._internal.exceptions.InstallationError: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects
Remote version of pip: 24.0
Local version of pip:  24.0
Was pip installed by pip? True
Removed build tracker: '/tmp/pip-build-tracker-ih8jssr0'


### More info

I have tried installing in a clean virtualenv, and again after manually installing Cython. I got the same result both times.

25.1.2 installs fine.
minrk commented 2 months ago

When you say Try to install pyzmq, can you include the exact command? Cython is a build dependency, so it should be in the build env. so either Cython is missing from the build env, or the Python executable found in the build env is wrong. It appears to be the latter, because Python_EXECUTABLE should resolve to the Python in the isolated build env, but /home/davidlaw/.pyenv/versions/pyston-2.3.5/envs/pyzmq-test-pyston-2.3.5/bin/python is clearly an env made with pyenv, not a temporary env created by pip/build.

Including the output up to the start of building bundled libzmq would help as well. Full output's easiest to make sure nothing is missing.

minrk commented 2 months ago

oh, I see it. It's the implementation_name check - the two backends are opt-in for cpython and pypy, so no backend dependency is installed for other implementations. Fix coming right up.

minrk commented 2 months ago

Fixed by #1986

dmrlawson commented 2 months ago

Brilliant, many thanks!

minrk commented 2 months ago

26.0.3 is out and should fix this. Let me know if you still have issues!