Cirq simulator device error

Trying to runt the qGANs tutorial (https://pennylane.ai/qml/demos/tutorial_QGAN.html) on jupyter notebooks but I keep getting ‘DeviceError: Device does not exist. Make sure the required plugin is installed.’ when the cirq.simulator is called for

Hi @Zohim_Chandani. Welcome to the forum and thanks for using PennyLane ! Have you installed the PennyLane-Cirq plugin by using the following command?

$ pip install pennylane-cirq

Please take a look here and let us know if the error is still present.

Successfully installed pennylane-cirq-0.9.0

but when I run: dev = qml.device(‘cirq.simulator’, wires=3)
I get DeviceError: Device does not exist. Make sure the required plugin is installed.

Thanks @Zohim_Chandani. Could you please tell me which versions of Python, PennyLane, Cirq, and TensorFlow you have installed and which code editor you use?

python 3.7.4
tensorflow 2.1.0
pennylane 0.10.0
pennylane-cirq 0.9.0

Could you please also run this:

print(cirq.__version__)

I get NameError: name ‘cirq’ is not defined

and when i run dev = qml.device(‘cirq.simulator’, wires=3)
I get
ContextualVersionConflict: (protobuf 3.8.0 (c:\programdata\anaconda3\lib\site-packages), Requirement.parse(‘protobuf>=3.12.0’), {‘google-api-core’})

Could you please follow these steps and let me know the result?

pip uninstall google-api-core
pip install google-api-core==1.20.0
pip uninstall cirq
pip install cirq

Also, did you observe any warning message when installing cirq and cirq plugin?

No issues when installing cirq and cirq plugin but uninstalling google api core and installing it again seems to have fixed the issue. Thankyou.

Hello.

I am having similar problems while trying to run https://pennylane.ai/qml/demos/tutorial_quantum_transfer_learning.html .

I get the following response:

"OSError Traceback (most recent call last)
in
----> 1 import torch
2 import torch.nn as nn
3 import torch.optim as optim
4 from torch.optim import lr_scheduler
5 import torchvision

C:\ProgramData\Anaconda3\lib\site-packages\torch_init_.py in
79 dlls = glob.glob(os.path.join(th_dll_path, ‘*.dll’))
80 for dll in dlls:
—> 81 ctypes.CDLL(dll)
82
83

C:\ProgramData\Anaconda3\lib\ctypes_init_.py in init(self, name, mode, handle, use_errno, use_last_error)
362
363 if handle is None:
–> 364 self._handle = _dlopen(self._name, mode)
365 else:
366 self._handle = handle

OSError: [WinError 182] The operating system cannot run %1"

I have installed all packages before through Anaconda.

Hi @_risto,

It appears there is something wrong with your pytorch installation.

Doing a quick search of the error message reveals the following similar github issue for PyTorch (with suggested solutions). I’d recommend considering some of the suggestions from there.