Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython builds on python3.8+ on MacOS appears to be broken #253205

Open
jakeschurch opened this issue Sep 4, 2023 · 0 comments
Open

Cython builds on python3.8+ on MacOS appears to be broken #253205

jakeschurch opened this issue Sep 4, 2023 · 0 comments
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin 6.topic: python

Comments

@jakeschurch
Copy link
Contributor

jakeschurch commented Sep 4, 2023

Describe the bug

Building cython from python3.8+ with OSs (like darwin) that default multiprocessing start method set to spawn creates infinite build loop.

Known upstream bug of cython

Blurb from upstream issue:

When

Cython.Build.cythonize(..., nthreads=1) is called
from a typical setup.py script
that does not guard its execution with the if name == 'main' idiom
and multiprocessing's start method is set to "spawn",
then

starting a new process will run the initial code again up until the next cythonize/multiprocessing.Pool call,
which will then repeatedly fail with a
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

Steps To Reproduce

Steps to reproduce the behavior:

  1. attempt to build package with cython as dependency from python3.10 set on m1 mac

Expected behavior

Cython builds, exits.

Additional context

Please note there is a bugfix that has been sitting for 4 years - cython/cython#3263. I have applied to cython patches for 0.29.36 version and seems to fix fine. I'm not sure if we want to consider this as an option, but have added my voice to the upstream conversation to see if that fix can be merged; and if not what I can do to support.

Notify maintainers

@FRidh

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "aarch64-darwin"
  • host os: Darwin 22.1.0, macOS 13.0.1
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.11.1
  • channels(jake): "darwin, home-manager-22.11.tar.gz"
  • channels(root): "nixpkgs"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixpkgs
@jakeschurch jakeschurch added the 0.kind: bug Something is broken label Sep 4, 2023
@jakeschurch jakeschurch changed the title Cython builds on python3.8+ on MacOS broken Cython builds on python3.8+ on MacOS appears to be broken Sep 4, 2023
@FRidh FRidh added 6.topic: python 6.topic: darwin Running or building packages on Darwin labels Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin 6.topic: python
Projects
None yet
Development

No branches or pull requests

2 participants