Amazon Braket Issue - stuck cells

Hello, I’ve discussed an Amazon Braket issue on Discord and was directed here. When I make a call into Amazon Braket within Jupyter cell, it works fine. All the code before, between and after the calls into Braket is executed properly. However, any cell that is executed afterwards is stuck.

To reproduce, please put the code below into a Jupyter cell (assuming you have AWS credentials configured in your environment). Run the cell, and then try to run another cell within Jupter, as simple as a print statement and Jupyter will get stuck until you interrupt it and restart the kernel.

Cell 1:

import pennylane as qml
from braket.devices import Devices
dev = qml.device("braket.aws.qubit", device_arn=Devices.Amazon.SV1, wires=1, shots=256)

@qml.qnode(dev)
def flip():
    qml.X(wires=0)
    return qml.probs(wires=0)

print("1")
res = flip()
print(res)
print(2)
res2 = flip()
print(res2)
print(3)

It will output:

1
[0. 1.]
2
[0. 1.]
3

Cell 2:

print("4")

It will get stuck after cell 1 is done executing.

qml.about() output:

Name: PennyLane
Version: 0.38.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: d:\dev\quantotto\quantum\qvenv\lib\site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: amazon-braket-pennylane-plugin, PennyLane-qiskit, PennyLane_Lightning

Platform info:           Windows-10-10.0.22631-SP0
Python version:          3.10.11
Numpy version:           1.26.3
Scipy version:           1.11.4
Installed devices:
- braket.aws.ahs (amazon-braket-pennylane-plugin-1.28.0)
- braket.aws.qubit (amazon-braket-pennylane-plugin-1.28.0)
- braket.local.ahs (amazon-braket-pennylane-plugin-1.28.0)
- braket.local.qubit (amazon-braket-pennylane-plugin-1.28.0)
- default.clifford (PennyLane-0.38.0)
- default.gaussian (PennyLane-0.38.0)
- default.mixed (PennyLane-0.38.0)
- default.qubit (PennyLane-0.38.0)
- default.qubit.autograd (PennyLane-0.38.0)
- default.qubit.jax (PennyLane-0.38.0)
- default.qubit.legacy (PennyLane-0.38.0)
- default.qubit.tf (PennyLane-0.38.0)
- default.qubit.torch (PennyLane-0.38.0)
- default.qutrit (PennyLane-0.38.0)
- default.qutrit.mixed (PennyLane-0.38.0)
- default.tensor (PennyLane-0.38.0)
- null.qubit (PennyLane-0.38.0)
- lightning.qubit (PennyLane_Lightning-0.38.0)
- qiskit.aer (PennyLane-qiskit-0.38.0)
- qiskit.basicaer (PennyLane-qiskit-0.38.0)
- qiskit.basicsim (PennyLane-qiskit-0.38.0)
- qiskit.remote (PennyLane-qiskit-0.38.0)

Could someone please check this use case?

Thank you!
Yev

Hi @quantotto, welcome to the Forum and thank you for posting the issue here!

We’ll do some tests and I’ll let you know as soon as we have more info on this issue.

1 Like

Hello @CatalinaAlbornoz
Were you able to check it?
Thanks!

Hi @quantotto ,

I’m sorry I didn’t get back to you earlier. The team’s conclusion was that this doesn’t seem to be a PennyLane issue since code runs as expected within a single cell. This could be an issue with Jupyter, Braket, or the plugin, which is maintained by the Braket team.

The recommendation was to open a bug report in the Braket plugin repository (here).

I’m sorry I don’t have better news. I hope you’ve still been able to run your programs within a single cell in the meantime.