I'm trying to understand how to use Recirq for QAOA, and I tried to run the notebook for tasks: https://quantumai.google/cirq/experiments/qaoa/tasks. But it gives a "iteration over a 0-d array" error when I run

for task in precompute_tasks:              

I don't know how to fix this. I want to get their code to run for 5 qubits and get an understanding of how to use and maybe modify it.

  • $\begingroup$ Is this the whole code you are using or is there more? $\endgroup$ Commented Jul 29, 2021 at 17:03
  • $\begingroup$ It comes from the notebook on the website, which can be downloaded or run on Google's colab. It's the 9th cell of the notebook, so I just gave the specific cell that had the problem. $\endgroup$ Commented Jul 29, 2021 at 17:12
  • $\begingroup$ I see, you pressed the litle play button and got the error right? $\endgroup$ Commented Jul 29, 2021 at 17:16
  • $\begingroup$ I have downloaded the notebook and run that, as well as running it in colab and pressing the play buttons to run the cells. $\endgroup$ Commented Jul 29, 2021 at 17:18
  • $\begingroup$ I rebuild your tasks and got the same error. Let me some time to investigate a bit. $\endgroup$ Commented Jul 29, 2021 at 17:31

1 Answer 1


This seems like a bug in the notebook / ReCirq - I filed https://github.com/quantumlib/ReCirq/issues/191.

This is a JSON serialization issue when ReCirq is trying to save the task in JSON format.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.