Rare problem with numpy and dedalus

44 views
Skip to first unread message

Andrei Igoshev

unread,
Jan 13, 2026, 4:58:48 AMJan 13
to Dedalus Users
Dear All,

I use Dedalus 3 and run essentially the same code on multiple machines. Recently I tried to install Dedalus on new HPC university facility. Example problems from Dedalus web-site ran fine, but my code showed the following error:

Traceback (most recent call last):

  File "/mnt/nfs/home/nai77/two_fluids/anelastic_MHD.py", line 172, in <module>

    solver = problem.build_solver(timestepper)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/problems.py", line 98, in build_solver

    return self.solver_class(self, *args, **kw)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/solvers.py", line 565, in __init__

    self.build_matrices(self.subproblems, ['M', 'L'])

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/solvers.py", line 131, in build_matrices

    subsystems.build_subproblem_matrices(self, subproblems, matrices)

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/subsystems.py", line 81, in build_subproblem_matrices

    subproblem.build_matrices(matrices)

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/subsystems.py", line 520, in build_matrices

    eqn_blocks = eqn[name].expression_matrices(subproblem=self, vars=vars, ncc_cutoff=solver.ncc_cutoff, max_ncc_terms=solver.max_ncc_terms)

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/arithmetic.py", line 190, in expression_matrices

    arg_matrices = arg.expression_matrices(subproblem, vars, **kw)

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/operators.py", line 778, in expression_matrices

    operator_mat = self.subproblem_matrix(subproblem)

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/operators.py", line 3195, in subproblem_matrix

    matrix = self._wrap_radial_matrix(regindex_in, regindex_out, ell, return_zeros=False)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/operators.py", line 3219, in _wrap_radial_matrix

    return self.radial_matrix(regindex_in, regindex_out, ell)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/mnt/nfs/home/nai77/venv/dedalus/lib/python3.11/site-packages/dedalus/core/basis.py", line 4776, in radial_matrix

    matrix[0, 0] = unit_amplitude

    ~~~~~~^^^^^^

ValueError: setting an array element with a sequence.


Exactly the same code runs fine on my own laptop and another HPC. I have successfully solved this problem by downgrading numpy to version 2.2.1.


Best regards,

Andrei Igoshev

Keaton Burns

unread,
Jan 13, 2026, 9:54:24 AMJan 13
to dedalu...@googlegroups.com
Hi Andrei,

This should be fixed with the latest commit on the main branch of Dedalus. Could you try a source build from that with the newer version of numpy on your cluster? If that works I’ll release a new patch update to conda/pip.

Thanks,
-Keaton


--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/3cd373d7-38b3-4128-9eac-5360d542af53n%40googlegroups.com.

Andrei Igoshev

unread,
Jan 13, 2026, 11:16:54 AMJan 13
to dedalu...@googlegroups.com
Dear Keaton,

Thank you very much for your fast reply.

I have installed Dedalus using:
git clone -b master https://github.com/DedalusProject/dedalus
cd dedalus
CC=mpicc pip3 install --no-cache --no-build-isolation .

Simulations starts, but I got the following warning:

/mnt/nfs/home/nai77/venv1/dedalus/lib/python3.11/site-packages/scipy/sparse/_construct.py:543: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.

Note: In Python 3.11, this warning can be generated by a call of scipy.sparse.diags(), but the code indicated in the warning message will refer to an internal call of scipy.sparse.diags_array(). If that happens, check your code for the use of diags().

  A = diags_array(diagonals, offsets=offsets, shape=shape, dtype=dtype)

2026-01-13 16:14:57,888 subsystems 0/4 INFO :: Building subproblem matrices 1/17 (~6%) Elapsed: 0s, Remaining: 7s, Rate: 2.4e+00/s

/mnt/nfs/home/nai77/venv1/dedalus/lib/python3.11/site-packages/scipy/sparse/_construct.py:543: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.

Note: In Python 3.11, this warning can be generated by a call of scipy.sparse.diags(), but the code indicated in the warning message will refer to an internal call of scipy.sparse.diags_array(). If that happens, check your code for the use of diags().

  A = diags_array(diagonals, offsets=offsets, shape=shape, dtype=dtype)

/mnt/nfs/home/nai77/venv1/dedalus/lib/python3.11/site-packages/scipy/sparse/_construct.py:543: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.

Note: In Python 3.11, this warning can be generated by a call of scipy.sparse.diags(), but the code indicated in the warning message will refer to an internal call of scipy.sparse.diags_array(). If that happens, check your code for the use of diags().

  A = diags_array(diagonals, offsets=offsets, shape=shape, dtype=dtype)

/mnt/nfs/home/nai77/venv1/dedalus/lib/python3.11/site-packages/scipy/sparse/_construct.py:543: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.

Note: In Python 3.11, this warning can be generated by a call of scipy.sparse.diags(), but the code indicated in the warning message will refer to an internal call of scipy.sparse.diags_array(). If that happens, check your code for the use of diags().

  A = diags_array(diagonals, offsets=offsets, shape=shape, dtype=dtype)



Best regards,
Andrei Igoshev


You received this message because you are subscribed to a topic in the Google Groups "Dedalus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dedalus-users/qMLb0nFwuL8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/CADZXxBh2JojGDuSjMmpSt3dOzRqo7_c6o%2BtKK3U8G8VAPAi9QQ%40mail.gmail.com.

Manohar Teja

unread,
Jan 15, 2026, 10:58:13 AMJan 15
to Dedalus Users
Hi,

I just want to mention that I see a similar error as well, but originating from the subsystems.py file. See the warning below:

/home/e6a/mk737.e6a/miniforge3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/subsystems.py:548: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  valid_var = sparse.diags(np.concatenate([v.ravel() for v in valid_var], dtype=int)).tocsr()
2026-01-14 17:30:46,088 subsystems 0/64 INFO :: Building subproblem matrices 1/4 (~25%) Elapsed: 0s, Remaining: 0s, Rate: 3.1e+01/s

Any update on why this is happening and how can this be fixed? 

Manohar Teja

unread,
Jan 15, 2026, 10:58:13 AMJan 15
to dedalu...@googlegroups.com
Hi,

I am facing similar problem but with subsystems.py (see warning message below). Any updates on how to fix this?

/home/e6a/mk737.e6a/miniforge3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/subsystems.py:548: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.

  valid_var = sparse.diags(np.concatenate([v.ravel() for v in valid_var], dtype=int)).tocsr()

2026-01-14 17:30:46,088 subsystems 0/64 INFO :: Building subproblem matrices 1/4 (~25%) Elapsed: 0s, Remaining: 0s, Rate: 3.1e+01/s

Regards
Manohar
CGAFD, Univ of Exeter


Reply all
Reply to author
Forward
0 new messages