quantumlib/qsim

Running the first example in qsimcirq tutorial results in error AttributeError: 'Circuit' object has no attribute 'device'

rht opened this issue · 2 comments

rht commented

I tried running the first example in https://quantumai.google/qsim/tutorials/qsimcirq, encountered the following error

    qsim_simulator = qsimcirq.QSimSimulator()
  File "/home/rht/code/venv/lib/python3.10/site-packages/cirq/sim/simulator.py", line 492, in simulate
    return self.simulate_sweep(
  File "/home/rht/code/venv/lib/python3.10/site-packages/qsimcirq/qsim_simulator.py", line 351, in simulate_sweep
    program = qsimc.QSimCircuit(program, device=program.device)
AttributeError: 'Circuit' object has no attribute 'device'

I installed Cirq and qsimcirq less than an hour ago, and so it is the latest version from PyPI.

Python version: 3.10.5
Cirq version: 0.15.0
qsimcirq version: 0.9.5
OS: NixOS 22.11 (Raccoon)

This is a known issue with Python 3.10: #537. We are actively working on a fix, but in the meantime it's possible to work around the issue by using an older version of Python (e.g. using pyenv).

Closing as duplicate.

rht commented

Thank you for the fast response! For now, I am using the Docker version gcr.io/quantum-builds/github.com/quantumlib/jupyter_qsim:latest, which uses Python 3.6 (already EOL).