Skip to content

BUG: Errors when upgrading to gcc version 15 #1401

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

Open
mvds314 opened this issue May 14, 2025 · 11 comments · Fixed by #1403
Open

BUG: Errors when upgrading to gcc version 15 #1401

mvds314 opened this issue May 14, 2025 · 11 comments · Fixed by #1403
Labels
bug Something isn't working C-backend installation

Comments

@mvds314
Copy link

mvds314 commented May 14, 2025

Describe the issue:

I am getting compiler errors when I upgrade from from gcc 14 to 15 (under Windows using the gcc compiler of MSYS2).

I don't understand the details, but according to ChatGpt:

When PyTensor generates its C++ extension code (mod.cpp), it includes NumPy headers with:

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

With GCC 15, deprecated functions in NumPy's C-API now raise hard errors, whereas GCC 14 would compile with a warning.

Reproducable code example:

import pytensor
from pytensor import tensor as pt

a = pt.dscalar()
b = pt.dscalar()
c = a + b
f = pytensor.function([a, b], c)

assert 4.0 == f(1.5, 2.5)

Error message:

segmentation fault (core dumped) python

PyTensor version information:

2.30.3

Context for the issue:

No response

@mvds314 mvds314 added the bug Something isn't working label May 14, 2025
@ricardoV94
Copy link
Member

ricardoV94 commented May 14, 2025

May be related to #1398.

How did you install PyTensor?

Is there any error message/stacktrace?

ChatGPT answer is completely senseless, you would see a compile error in that case.

CC @maresb @lucianopaz

@maresb
Copy link
Contributor

maresb commented May 14, 2025

Hi @mvds314, please recreate your Conda environment. That will force gcc 14.

@ricardoV94
Copy link
Member

Would still be useful to know if it's the same error or different

@maresb
Copy link
Contributor

maresb commented May 14, 2025

whereas GCC 14 would compile with a warning

Also what's the warning?

@mvds314
Copy link
Author

mvds314 commented May 16, 2025

The error I got was so long, that I coudn't really figure out what the actual error is.
I solved it by downgrading my gcc in MSYS2 to version 14 as ChatGpt suggested, then everything works as expected.

Also, I am not using Anaconda, I am using winpython with Python version 3.13 and installed pytensor with pip.

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error_11j8i4uf
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: ExpandDims{axes=[0, 1]}(0.8)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
return unconditional_constant_folding.transform(fgraph, node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpfs1rbpul\m52592e18fb66ba378e5be6fe9bccf91a7fa21d4d238285546214d2f3b9d3aec5.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpfs1rbpul\mod.cpp" "..\python\python313.dll"

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error_elvweyp2
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: ExpandDims{axes=[0, 1]}(0.4)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
return unconditional_constant_folding.transform(fgraph, node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpryywwxq_\m52592e18fb66ba378e5be6fe9bccf91a7fa21d4d238285546214d2f3b9d3aec5.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpryywwxq_\mod.cpp" "..\python\python313.dll"

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error_m23915ax
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: ExpandDims{axes=[0, 1]}(0.8)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
return unconditional_constant_folding.transform(fgraph, node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpbjrxt6xo\m52592e18fb66ba378e5be6fe9bccf91a7fa21d4d238285546214d2f3b9d3aec5.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpbjrxt6xo\mod.cpp" "..\python\python313.dll"

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error_uqafz_v9
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: ExpandDims{axes=[0, 1]}(0.4)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
return unconditional_constant_folding.transform(fgraph, node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpadko9n0z\m52592e18fb66ba378e5be6fe9bccf91a7fa21d4d238285546214d2f3b9d3aec5.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpadko9n0z\mod.cpp" "..\python\python313.dll"

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error__gtv7gqm
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: ExpandDims{axes=[0, 1]}(0.8)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
return unconditional_constant_folding.transform(fgraph, node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpdh9_sens\m52592e18fb66ba378e5be6fe9bccf91a7fa21d4d238285546214d2f3b9d3aec5.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmpdh9_sens\mod.cpp" "..\python\python313.dll"

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error_m5iggf5r
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: ExpandDims{axes=[0, 1]}(0.4)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
return unconditional_constant_folding.transform(fgraph, node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
return self.fn(fgraph, node)
~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmple51mlrc\m52592e18fb66ba378e5be6fe9bccf91a7fa21d4d238285546214d2f3b9d3aec5.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmple51mlrc\mod.cpp" "..\python\python313.dll"

You can find the C code in this temporary file: C:\Users\USERNAME\AppData\Local\Temp\pytensor_compilation_error_n5xsfake
Traceback (most recent call last):
File "..\python\Lib\site-packages\pytensor\link\vm.py", line 1230, in make_all
node.op.make_thunk(node, storage_map, compute_map, [], impl=impl)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmp_oc9l42q\me7fa920728e5d2389ff334307defa22f3d9bd0933d7665ee04ca7b89f0a69b2d.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmp_oc9l42q\mod.cpp" -lopenblas -lgfortran "..\python\python313.dll"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\USERNAME\Repos\TCM\calibrations\TCM4\check_blas.py", line 13, in
exec(open(file).read())
~~~~^^^^^^^^^^^^^^^^^^^
File "", line 274, in
File "", line 57, in execute
File "..\python\Lib\site-packages\pytensor\compile\function_init_.py", line 332, in function
fn = pfunc(
params=inputs,
...<12 lines>...
trust_input=trust_input,
)
File "..\python\Lib\site-packages\pytensor\compile\function\pfunc.py", line 466, in pfunc
return orig_function(
inputs,
...<8 lines>...
trust_input=trust_input,
)
File "..\python\Lib\site-packages\pytensor\compile\function\types.py", line 1833, in orig_function
fn = m.create(defaults)
File "..\python\Lib\site-packages\pytensor\compile\function\types.py", line 1717, in create
_fn, _i, _o = self.linker.make_thunk(
~~~~~~~~~~~~~~~~~~~~~~^
input_storage=input_storage_lists, storage_map=storage_map
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\basic.py", line 245, in make_thunk
return self.make_all(
~~~~~~~~~~~~~^
input_storage=input_storage,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
output_storage=output_storage,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
storage_map=storage_map,
^^^^^^^^^^^^^^^^^^^^^^^^
)[:3]
^
File "..\python\Lib\site-packages\pytensor\link\vm.py", line 1239, in make_all
raise_with_op(fgraph, node)
~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\utils.py", line 526, in raise_with_op
raise exc_value.with_traceback(exc_trace)
File "..\python\Lib\site-packages\pytensor\link\vm.py", line 1230, in make_all
node.op.make_thunk(node, storage_map, compute_map, [], impl=impl)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\python\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
input_storage=node_input_storage, output_storage=node_output_storage
)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
~~~~~~~~~~~~~~~~^
input_storage, output_storage, storage_map, cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in compile
thunk, module = self.cthunk_factory(
~~~~~~~~~~~~~~~~~~~^
error_storage,
^^^^^^^^^^^^^^
...<3 lines>...
cache,
^^^^^^
)
^
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
module = lnk.compile_cmodule(location)
File "..\python\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
module = c_compiler.compile_str(
module_name=mod.code_hash,
...<5 lines>...
preargs=preargs,
)
File "..\python\Lib\site-packages\pytensor\link\c\cmodule.py", line 2676, in compile_str
raise CompileError(
f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
)
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmp_oc9l42q\me7fa920728e5d2389ff334307defa22f3d9bd0933d7665ee04ca7b89f0a69b2d.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmp_oc9l42q\mod.cpp" -lopenblas -lgfortran "..\python\python313.dll"

Apply node that caused the error: Gemm{inplace}(<Matrix(float64, shape=(?, ?))>, 0.8, <Matrix(float64, shape=(?, ?))>, <Matrix(float64, shape=(?, ?))>, 0.4)
Toposort index: 0
Inputs types: [TensorType(float64, shape=(None, None)), TensorType(float64, shape=()), TensorType(float64, shape=(None, None)), TensorType(float64, shape=(None, None)), TensorType(float64, shape=())]

@maresb
Copy link
Contributor

maresb commented May 16, 2025

Thanks @mvds314 for the additional info!

The output shows essentially the same error occurring over and over. If you're lucky you may be able to paste one of those long lines from your output (it should look like the following), and hopefully it executes and shows a more informative error message:

"..\msys64\mingw64\bin\g++.EXE" -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"..\python\Lib\site-packages\numpy_core\include" -I"..\python\include" -I"..\python\Lib\site-packages\pytensor\link\c\c_code" -L"..\python\libs" -L"..\python" -o "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmp_oc9l42q\me7fa920728e5d2389ff334307defa22f3d9bd0933d7665ee04ca7b89f0a69b2d.pyd" "C:\Users\USERNAME\AppData\Local\PyTensor\compiledir_Windows-11-10.0.22631-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.13.3-64\tmp_oc9l42q\mod.cpp" -lopenblas -lgfortran "..\python\python313.dll"

My expectation is that this is somehow a duplicate of #1398, but I'm surprised that you're not getting the same ImportError: DLL load failed while importing.

@mvds314
Copy link
Author

mvds314 commented May 16, 2025

When I do this, I get a popup window with

The procedure entry point clock_gettime64 could not be located in the dynamic link library

C:\....\msys64\mingw64\bin\...\lib\gcc\x86_64-w64-mingw32/15.1.0\cc1plus.exe

@maresb
Copy link
Contributor

maresb commented May 17, 2025

Thanks a lot @mvds314 for the extra info, that is indeed extremely helpful. Based on that I'm proposing a possible fix in #1403.

@maresb
Copy link
Contributor

maresb commented May 19, 2025

Reopening because I think we'd need to merge also #1400 to fix this.

@maresb maresb reopened this May 19, 2025
@ricardoV94
Copy link
Member

Reopening because I think we'd need to merge also #1400 to fix this.

It's merged

@maresb
Copy link
Contributor

maresb commented May 20, 2025

@mvds314 could you please try again with the version we just released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C-backend installation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants