-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Hi PyGSTi team,
I'm currently a beginner learning PyGSTi and working through the 00-Protocols tutorial, and I encountered a KeyError related to 'Gxpi2' when executing the following line from the example:
# define the quantum processor (or piece of a processor) we'll be doing RB on
qubit_labels = ['Q1']
gate_names = ['Gxpi2', 'Gxmpi2', 'Gypi2', 'Gympi2']
pspec = pygsti.processors.QubitProcessorSpec(len(qubit_labels), gate_names,
qubit_labels=qubit_labels)
depths = [0, 10, 20, 30]
circuits_per_depth = 50
# Create compilation rules from native gates to Cliffords
from pygsti.processors import CliffordCompilationRules as CCR
compilations = {'absolute': CCR.create_standard(pspec, 'absolute', ('paulis', '1Qcliffords'), verbosity=0), 'paulieq': CCR.create_standard(pspec, 'paulieq', ('1Qcliffords', 'allcnots'), verbosity=0)}
This results in the following traceback:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[6], line 11
9 # Create compilation rules from native gates to Cliffords
10 from pygsti.processors import CliffordCompilationRules as CCR
---> 11 compilations = {'absolute': CCR.create_standard(pspec, 'absolute', ('paulis', '1Qcliffords'), verbosity=0),
12 'paulieq': CCR.create_standard(pspec, 'paulieq', ('1Qcliffords', 'allcnots'), verbosity=0)}
14 # create an experiment design
15 exp_design = pygsti.protocols.CliffordRBDesign(pspec, compilations, depths, circuits_per_depth)
File c:\ProgramData\miniconda3\envs\qutip-mkl\Lib\site-packages\pygsti\processors\compilationrules.py:504, in CliffordCompilationRules.create_standard(cls, base_processor_spec, compile_type, what_to_compile, verbosity)
499 print(
500 "- Creating a circuit to implement {} {} on qubit {}...".format(gname, descs[compile_type],
501 q))
502 # This does a brute-force search to compile the gate, by creating `templates` when necessary, and using
503 # a template if one has already been constructed.
--> 504 compilation_rules.add_local_compilation_of(_Label(gname, q), verbosity=verbosity)
505 if verbosity > 0: print("Complete.")
507 # Manually add in the "obvious" compilations for CNOT gates as templates, so that we use the normal conversions
508 # based on the Hadamard gate -- if this is possible. If we don't do this, we resort to random compilations,
509 # which might not give the "expected" compilations (even if the alternatives might be just as good).
File c:\ProgramData\miniconda3\envs\qutip-mkl\Lib\site-packages\pygsti\processors\compilationrules.py:789, in CliffordCompilationRules.add_local_compilation_of(self, oplabel, unitary, srep, max_iterations, force, verbosity)
751 def add_local_compilation_of(self, oplabel, unitary=None, srep=None, max_iterations=10, force=False, verbosity=1):
752 """
753 Adds a new local compilation of `oplabel`.
754
(...) 787 None
788 """
--> 789 circuit = self._get_local_compilation_of(oplabel, unitary, srep, max_iterations, force, verbosity)
790 self.add_specific_compilation_rule(oplabel, circuit, unitary)
File c:\ProgramData\miniconda3\envs\qutip-mkl\Lib\site-packages\pygsti\processors\compilationrules.py:744, in CliffordCompilationRules._get_local_compilation_of(self, oplabel, unitary, srep, max_iterations, force, verbosity)
741 if not force and oplabel in self.specific_compilations:
742 return self.specific_compilations[oplabel] # don't re-compute unless we're told to
--> 744 circuit = self._create_local_compilation_of(oplabel,
745 unitary=unitary,
746 srep=srep,
747 max_iterations=max_iterations,
748 verbosity=verbosity)
749 return circuit
File c:\ProgramData\miniconda3\envs\qutip-mkl\Lib\site-packages\pygsti\processors\compilationrules.py:691, in CliffordCompilationRules._create_local_compilation_of(self, oplabel, unitary, srep, max_iterations, verbosity)
688 if is_local_compilation_feasible(available_gatenames):
689 available_gatelabels = [to_template_label(gl) for gn in available_gatenames
690 for gl in self.processor_spec.available_gatelabels(gn, oplabel.sslbls)]
--> 691 template_to_use = self.add_clifford_compilation_template(
692 oplabel.name, oplabel.num_qubits, unitary, srep,
693 available_gatelabels, available_srep_dict,
694 verbosity=verbosity, max_iterations=max_iterations)
696 #If a template has been found, use it.
697 if template_to_use is not None:
File c:\ProgramData\miniconda3\envs\qutip-mkl\Lib\site-packages\pygsti\processors\compilationrules.py:884, in CliffordCompilationRules.add_clifford_compilation_template(self, gate_name, nqubits, unitary, srep, available_gatelabels, available_sreps, verbosity, max_iterations)
882 # Find the symplectic action of all possible circuits of length 1 on the qubits
883 for layer in all_layers:
--> 884 obtained_sreps[layer] = _symp.symplectic_rep_of_clifford_layer(layer, nqubits, srep_dict=available_sreps)
886 # find the 1Q identity gate name
887 I_name = self._find_std_gate(self.processor_spec, 'I')
File c:\ProgramData\miniconda3\envs\qutip-mkl\Lib\site-packages\pygsti\tools\symplectic.py:1191, in symplectic_rep_of_clifford_layer(layer, n, q_labels, srep_dict, add_internal_sreps)
1188 layer = _Label(layer)
1190 for sub_lbl in layer.components:
-> 1191 matrix, phase = srep_dict[sub_lbl.name]
1192 nforgate = sub_lbl.num_qubits
1193 sub_lbl_qubits = sub_lbl.qubits if (sub_lbl.qubits is not None) else q_labels
KeyError: 'Gxpi2'
I'm using PyGSTi version: 0.9.13, and I tried using Python versions 3.12 and 3.13 but it didn't work. The following are all the packages installed in the entire conda environment:
# Name Version Build Channel
_openmp_mutex 4.5 2_gnu conda-forge
asttokens 3.0.0 pyhd8ed1ab_1 conda-forge
brotli 1.1.0 h2466b09_2 conda-forge
brotli-bin 1.1.0 h2466b09_2 conda-forge
bzip2 1.0.8 h2466b09_7 conda-forge
ca-certificates 2025.4.26 h4c7d964_0 conda-forge
colorama 0.4.6 pyhd8ed1ab_1 conda-forge
comm 0.2.2 pyhd8ed1ab_1 conda-forge
contourpy 1.3.2 py312hd5eb7cc_0 conda-forge
cpython 3.12.11 py312hd8ed1ab_0 conda-forge
cycler 0.12.1 pyhd8ed1ab_1 conda-forge
cython 3.1.1 py312h890cc4b_1 conda-forge
debugpy 1.8.14 py312h275cf98_0 conda-forge
decorator 5.2.1 pyhd8ed1ab_0 conda-forge
exceptiongroup 1.3.0 pyhd8ed1ab_0 conda-forge
executing 2.2.0 pyhd8ed1ab_0 conda-forge
fonttools 4.58.1 py312h31fea79_0 conda-forge
freetype 2.13.3 h57928b3_1 conda-forge
importlib-metadata 8.7.0 pyhe01879c_1 conda-forge
intel-openmp 2024.2.1 h57928b3_1083 conda-forge
ipykernel 6.29.5 pyh4bbf305_0 conda-forge
ipython 9.3.0 pyh6be1c34_0 conda-forge
ipython_pygments_lexers 1.1.1 pyhd8ed1ab_0 conda-forge
jedi 0.19.2 pyhd8ed1ab_1 conda-forge
jinja2 3.1.6 pyhd8ed1ab_0 conda-forge
jupyter_client 8.6.3 pyhd8ed1ab_1 conda-forge
jupyter_core 5.8.1 pyh5737063_0 conda-forge
kiwisolver 1.4.8 py312hc790b64_0 conda-forge
krb5 1.21.3 hdf4eb48_0 conda-forge
lcms2 2.17 hbcf6048_0 conda-forge
lerc 4.0.0 h6470a55_1 conda-forge
libblas 3.9.0 31_h641d27c_mkl conda-forge
libbrotlicommon 1.1.0 h2466b09_2 conda-forge
libbrotlidec 1.1.0 h2466b09_2 conda-forge
libbrotlienc 1.1.0 h2466b09_2 conda-forge
libcblas 3.9.0 31_h5e41251_mkl conda-forge
libdeflate 1.24 h76ddb4d_0 conda-forge
libexpat 2.7.0 he0c23c2_0 conda-forge
libffi 3.4.6 h537db12_1 conda-forge
libfreetype 2.13.3 h57928b3_1 conda-forge
libfreetype6 2.13.3 h0b5ce68_1 conda-forge
libgcc 15.1.0 h1383e82_2 conda-forge
libgomp 15.1.0 h1383e82_2 conda-forge
libhwloc 2.11.2 default_ha69328c_1001 conda-forge
libiconv 1.18 h135ad9c_1 conda-forge
libjpeg-turbo 3.1.0 h2466b09_0 conda-forge
liblapack 3.9.0 31_h1aa476e_mkl conda-forge
liblzma 5.8.1 h2466b09_1 conda-forge
liblzma-devel 5.8.1 h2466b09_1 conda-forge
libpng 1.6.47 h7a4582a_0 conda-forge
libsodium 1.0.20 hc70643c_0 conda-forge
libsqlite 3.50.0 h67fdade_0 conda-forge
libtiff 4.7.0 h05922d8_5 conda-forge
libwebp-base 1.5.0 h3b0e114_0 conda-forge
libwinpthread 12.0.0.r4.gg4f2fc60ca h57928b3_9 conda-forge
libxcb 1.17.0 h0e4246c_0 conda-forge
libxml2 2.13.8 h442d1da_0 conda-forge
libzlib 1.3.1 h2466b09_2 conda-forge
markupsafe 3.0.2 py312h31fea79_1 conda-forge
matplotlib-base 3.10.3 py312h90004f6_0 conda-forge
matplotlib-inline 0.1.7 pyhd8ed1ab_1 conda-forge
mkl 2024.2.2 h66d3029_15 conda-forge
munkres 1.1.4 pyh9f0ad1d_0 conda-forge
narwhals 1.41.0 pyhe01879c_0 conda-forge
nest-asyncio 1.6.0 pyhd8ed1ab_1 conda-forge
networkx 3.5 pyhe01879c_0 conda-forge
numpy 2.2.6 py312h3150e54_0 conda-forge
openjpeg 2.5.3 h4d64b90_0 conda-forge
openssl 3.5.0 ha4e3fda_1 conda-forge
packaging 25.0 pyh29332c3_1 conda-forge
pandas 2.2.3 py312h72972c8_3 conda-forge
parso 0.8.4 pyhd8ed1ab_1 conda-forge
pickleshare 0.7.5 pyhd8ed1ab_1004 conda-forge
pillow 11.2.1 py312h078707f_0 conda-forge
pip 25.1.1 pyh8b19718_0 conda-forge
platformdirs 4.3.8 pyhe01879c_0 conda-forge
plotly 6.1.2 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.51 pyha770c72_0 conda-forge
psutil 7.0.0 py312h4389bb4_0 conda-forge
pthread-stubs 0.4 h0e40799_1002 conda-forge
pure_eval 0.2.3 pyhd8ed1ab_1 conda-forge
pygments 2.19.1 pyhd8ed1ab_0 conda-forge
pygsti 0.9.13 np20py312h994d5b2_4 conda-forge
pyparsing 3.2.3 pyhd8ed1ab_1 conda-forge
python 3.12.0 h2628c8c_0_cpython conda-forge
python-dateutil 2.9.0.post0 pyhff2d567_1 conda-forge
python-tzdata 2025.2 pyhd8ed1ab_0 conda-forge
python_abi 3.12 7_cp312 conda-forge
pytz 2025.2 pyhd8ed1ab_0 conda-forge
pywin32 307 py312h275cf98_3 conda-forge
pyzmq 26.4.0 py312hd7027bb_0 conda-forge
qhull 2020.2 hc790b64_5 conda-forge
scipy 1.15.2 py312h451d5c4_0 conda-forge
setuptools 80.9.0 pyhff2d567_0 conda-forge
six 1.17.0 pyhd8ed1ab_0 conda-forge
stack_data 0.6.3 pyhd8ed1ab_1 conda-forge
tbb 2021.13.0 h62715c5_1 conda-forge
tk 8.6.13 h2c6b04d_2 conda-forge
tornado 6.5.1 py312h4389bb4_0 conda-forge
traitlets 5.14.3 pyhd8ed1ab_1 conda-forge
typing_extensions 4.14.0 pyhe01879c_0 conda-forge
tzdata 2025b h78e105d_0 conda-forge
ucrt 10.0.22621.0 h57928b3_1 conda-forge
unicodedata2 16.0.0 py312h4389bb4_0 conda-forge
vc 14.3 h2b53caa_26 conda-forge
vc14_runtime 14.42.34438 hfd919c2_26 conda-forge
wcwidth 0.2.13 pyhd8ed1ab_1 conda-forge
wheel 0.45.1 pyhd8ed1ab_1 conda-forge
xorg-libxau 1.0.12 h0e40799_0 conda-forge
xorg-libxdmcp 1.1.5 h0e40799_0 conda-forge
xz 5.8.1 h208afaa_1 conda-forge
xz-tools 5.8.1 h2466b09_1 conda-forge
zeromq 4.3.5 ha9f60a1_7 conda-forge
zipp 3.22.0 pyhd8ed1ab_0 conda-forge
zstd 1.5.7 hbeecb71_2 conda-forge
Any help or clarification would be greatly appreciated!
Metadata
Metadata
Assignees
Labels
bugA bug or regressionA bug or regression