Open
Description
When running the below code in a jupyter notebook in Pycharm, it seems to instigate a race condition when printing with kernel.print()
. Running this code in a .py file in PyCharm is fine and running in a Jupyter notebook in the browser seems to work fine.
from bloqade import qasm2
from kirin.dialects import ilist
def ghz_linear(n: int):
n_qubits = int(2**n)
@qasm2.extended(fold=False, typeinfer=False)
def ghz_linear_program():
qreg = qasm2.qreg(n_qubits)
# Apply a Hadamard on the first qubit
qasm2.h(qreg[0])
# Create a cascading sequence of CX gates
# necessary for quantum computers that
# only have nearest-neighbor connectivity between qubits
for i in range(1, n_qubits):
qasm2.cx(qreg[i - 1], qreg[i])
return ghz_linear_program
kernel = ghz_linear(2)
for stmt in kernel.callable_region.walk():
print(stmt)
kernel.print()```
the results from pip freeze;
amazon-braket-default-simulator==1.26.4
amazon-braket-schemas==1.24.0
amazon-braket-sdk==1.91.2
annotated-types==0.7.0
antlr4-python3-runtime==4.9.2
anyio==4.9.0
appnope==0.1.4
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
autoray==0.7.1
babel==2.17.0
backoff==2.2.1
backports.entry-points-selectable==1.3.0
beartype==0.20.2
beautifulsoup4==4.13.4
bleach==6.2.0
bloqade==0.24.0
bloqade-analog==0.16.5
bloqade-circuit==0.2.1
bokeh==3.7.2
boltons==25.0.0
boto3==1.38.9
botocore==1.38.9
certifi==2025.4.26
cffi==1.17.1
charset-normalizer==3.4.2
cirq-core==1.5.0
cloudpickle==2.2.1
comm==0.2.2
contourpy==1.3.2
cotengra==0.7.2
cycler==0.12.1
cytoolz==1.0.1
debugpy==1.8.14
decorator==5.2.1
defusedxml==0.7.1
duet==0.2.9
executing==2.2.0
fastjsonschema==2.21.1
ffmpeg==1.4
filelock==3.18.0
fonttools==4.57.0
fqdn==1.5.1
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
idna==3.10
ipykernel==6.29.5
ipython==9.2.0
ipython_pygments_lexers==1.1.1
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
jmespath==1.0.1
json5==0.12.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2025.4.1
juliacall==0.9.24
juliapkg==0.1.16
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyterlab==4.4.1
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
kirin-toolchain==0.17.6
kiwisolver==1.4.8
lark==1.2.2
llvmlite==0.44.0
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7
mdurl==0.1.2
mistune==3.1.3
mpmath==1.3.0
mypy_extensions==1.1.0
narwhals==1.38.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
networkx==3.4.2
notebook==7.4.1
notebook_shim==0.2.4
numba==0.61.2
numpy==2.2.5
openpulse==1.0.1
openqasm3==1.0.1
opt_einsum==3.4.0
oqpy==0.3.7
ordered-set==4.1.0
overrides==7.7.0
packaging==25.0
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pillow==11.2.1
platformdirs==4.3.7
plotext==5.3.2
plum-dispatch==2.5.7
ply==3.11
prometheus_client==0.21.1
prompt_toolkit==3.0.51
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pycparser==2.22
pydantic==2.10.6
pydantic_core==2.27.2
Pygments==2.19.1
PyLaTeX==1.4.2
pyparsing==3.2.3
pyqasm==0.3.2
pyqrack==1.40.2
PyQt5==5.15.11
PyQt5-Qt5==5.15.16
PyQt5_sip==12.17.0
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.4.0
qbraid==0.9.6
qbraid-core==0.1.37
quimb==1.10.0
referencing==0.36.2
requests==2.32.3
requests-aws-sign==0.1.6
requests-sigv4==0.1.6
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==14.0.0
rpds-py==0.24.0
rustworkx==0.16.0
s3transfer==0.12.0
scipy==1.15.2
semver==3.0.4
Send2Trash==1.8.3
setuptools==80.3.1
simplejson==3.20.1
six==1.17.0
sniffio==1.3.1
sortedcontainers==2.4.0
soupsieve==2.7
stack-data==0.6.3
sympy==1.14.0
tabulate==0.9.0
terminado==0.18.1
tinycss2==1.4.0
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.2
tzdata==2025.2
uri-template==1.3.0
urllib3==2.4.0
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
xyzservices==2025.4.0