8000 BUG: Failed to compile numpy on python3.14.0a1 · Issue #27623 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Failed to compile numpy on python3.14.0a1 #27623

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

Closed
leftys opened this issue Oct 23, 2024 · 4 comments
Closed

BUG: Failed to compile numpy on python3.14.0a1 #27623

leftys opened this issue Oct 23, 2024 · 4 comments
Labels

Comments

@leftys
Copy link
leftys commented Oct 23, 2024

Describe the issue:

I tried to compile numpy on dockerized python3.14.0a1 and got the following error. Not sure if the issue is in numpy or cython though. I know python3.14 is not out yet, just getting ready for it :)

Reproduce the code example:

Put the following into ./Dockerfile:

# syntax=docker/dockerfile:1.3

FROM python:3.14.0a1-bookworm

RUN pip install cython meson-python ninja
RUN pip install numpy==2.1.2

and run docker build .

Error message:

(...)
#17 228.4       [581/618] Compiling Cython source /tmp/pip-install-ntvziawb/numpy_8b55308970374a40af6e2e37a260d38f/numpy/random/_mt19937.pyx
#17 228.4       [582/618] Compiling C object numpy/random/_philox.cpython-314-x86_64-linux-gnu.so.p/src_philox_philox.c.o
#17 228.4       [583/618] Compiling C object numpy/linalg/_umath_linalg.cpython-314-x86_64-linux-gnu.so.p/lapack_lite_f2c_z_lapack.c.o
#17 228.4       [584/618] Compiling Cython source /tmp/pip-install-ntvziawb/numpy_8b55308970374a40af6e2e37a260d38f/numpy/random/_common.pyx
#17 228.4       FAILED: numpy/random/_common.cpython-314-x86_64-linux-gnu.so.p/numpy/random/_common.pyx.c
#17 228.4       cython -M --fast-fail -3 /tmp/pip-install-ntvziawb/numpy_8b55308970374a40af6e2e37a260d38f/numpy/random/_common.pyx -o numpy/random/_common.cpython-314-x86_64-linux-gnu.so.p/numpy/random/_common.pyx.c
#17 228.4       Traceback (most recent call last):
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/bin/cython", line 8, in <module>
#17 228.4           sys.exit(setuptools_main())
#17 228.4                    ~~~~~~~~~~~~~~~^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Main.py", line 754, in setuptools_main
#17 228.4           return main(command_line = 1)
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Main.py", line 782, in main
#17 228.4           result = compile(sources, options)
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Main.py", line 673, in compile
#17 228.4           return compile_multiple(source, options)
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Main.py", line 647, in compile_multiple
#17 228.4           result = run_pipeline(source, options,
#17 228.4                                 full_module_name=options.module_name,
#17 228.4                                 context=context)
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Main.py", line 539, in run_pipeline
#17 228.4           err, enddata = Pipeline.run_pipeline(pipeline, source)
#17 228.4                          ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Pipeline.py", line 398, in run_pipeline
#17 228.4           data = run(phase, data)
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Pipeline.py", line 375, in run
#17 228.4           return phase(data)
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Pipeline.py", line 52, in generate_pyx_code_stage
#17 228.4           module_node.process_implementation(options, result)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ModuleNode.py", line 222, in process_implementation
#17 228.4           self.generate_c_code(env, options, result)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ModuleNode.py", line 516, in generate_c_code
#17 228.4           self.body.generate_function_definitions(env, code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 404, in generate_function_definitions
#17 228.4           stat.generate_function_definitions(env, code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 404, in generate_function_definitions
#17 228.4           stat.generate_function_definitions(env, code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 2212, in generate_function_definitions
#17 228.4           self.generate_function_body(env, code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 1971, in generate_function_body
#17 228.4           self.body.generate_execution_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 410, in generate_execution_code
#17 228.4           stat.generate_execution_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 7192, in generate_execution_code
#17 228.4           self.else_clause.generate_execution_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 410, in generate_execution_code
#17 228.4           stat.generate_execution_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 6069, in generate_execution_code
#17 228.4           self.generate_rhs_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/Nodes.py", line 6368, in generate_rhs_evaluation_code
#17 228.4           self.rhs.generate_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 836, in generate_evaluation_code
#17 228.4           self.generate_subexpr_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 851, in generate_subexpr_evaluation_code
#17 228.4           node.generate_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 6416, in generate_evaluation_code
#17 228.4           super(SimpleCallNode, self).generate_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 836, in generate_evaluation_code
#17 228.4           self.generate_subexpr_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 851, in generate_subexpr_evaluation_code
#17 228.4           node.generate_evaluation_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 842, in generate_evaluation_code
#17 228.4           self.generate_result_code(code)
#17 228.4           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
#17 228.4         File "/root/.cache/pypoetry/virtualenvs/bot-VA82Wl8V-py3.14/lib/python3.14/site-packages/Cython/Compiler/ExprNodes.py", line 7790, in generate_result_code
#17 228.4           elif self.entry.is_cpp_optional and self.initialized_check:
#17 228.4                ^^^^^^^^^^^^^^^^^^^^^^^^^^
#17 228.4       AttributeError: 'NoneType' object has no attribute 'is_cpp_optional'

Python and NumPy Versions:

python 3.14.0a1
numpy 2.1.2

Runtime Environment:

No response

Context for the issue:

No response

@leftys
Copy link
Author
leftys commented Oct 23, 2024

After some more research this might be caused by this Cython issue: cython/cython#6426 caused by underlaying cpython bug python/cpython#125868. It should be already fixed on cpython git, but I will probably wait for a cpython release before I test it again.

@da-woods
Copy link

It should be already fixed on cpython git

Not yet I'm afraid.

You could potentially skip compiling Cython itself with the environmental variable NO_CYTHON_COMPILE=1, but I'm not sure I'd trust that.

@leftys
Copy link
Author
leftys commented Oct 23, 2024

So in the end I tested it again from PR python/cpython#125876 and the compilation worked!

@ngoldbaum
Copy link
Member

It's unlikely we'll start testing NumPy against CPython releases until the first beta release, when the ABI stabilizes. If we supported it earlier than that we'd need to adapt to upstream changes which then might get backed out or iterated on in a way that would be obnoxious to deal with via CI. Waiting until the beta happens is much more sustainable.

If you want to send in patches to fix build errors on 3.14 please feel free to if it's a reasonable change and isn't contingent on something that might be backed out upstream.

Closing as not planned because building against 3.14.0a1 isn't something we're trying to support.

@ngoldbaum ngoldbaum closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
0