Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Qiskit >=1.0 #228

Open
mkrompiec opened this issue Dec 11, 2024 · 0 comments
Open

Incompatibility with Qiskit >=1.0 #228

mkrompiec opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mkrompiec
Copy link

Issue Description

Conversion from Qiskit 1.2.4 doesn't work, do to backward-incompatible changes in Qiskit>=1.0

How to Reproduce

import tensorcircuit as tc
c = tc.Circuit(2)
c.x(0)
c.cx(0, 1)
c_ = tc.Circuit.from_qiskit(c.to_qiskit())

Error Output

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[27], line 5
      3 c.x(0)
      4 c.cx(0, 1)
----> 5 c_ = tc.Circuit.from_qiskit(c.to_qiskit())

File ~/.pyenv/versions/3.12.7/envs/main_env/lib/python3.12/site-packages/tensorcircuit/abstractcircuit.py:889, in AbstractCircuit.from_qiskit(cls, qc, n, inputs, circuit_params, binding_params)
    886 if n is None:
    887     n = qc.num_qubits
--> 889 return qiskit2tc(  # type: ignore
    890     qc.data,
    891     n,
    892     inputs,
    893     circuit_constructor=cls,
    894     circuit_params=circuit_params,
    895     binding_params=binding_params,
    896 )

File ~/.pyenv/versions/3.12.7/envs/main_env/lib/python3.12/site-packages/tensorcircuit/translation.py:464, in qiskit2tc(qcdata, n, inputs, is_dm, circuit_constructor, circuit_params, binding_params)
    462 tc_circuit: Any = Circ(**circuit_params)
    463 for gate_info in qcdata:
--> 464     idx = [qb.index for qb in gate_info[1]]
    465     gate_name = gate_info[0].name
    466     parameters = _translate_qiskit_params(gate_info, binding_params)

AttributeError: 'Qubit' object has no attribute 'index'

Environment Context

OS info: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python version: 3.12.7
Numpy version: 1.26.4
Scipy version: 1.14.1
Pandas version: 2.2.3
TensorNetwork version: 0.5.1
Cotengra is not installed
TensorFlow is not installed
Jax version: 0.4.35
Jax installation doesn't support GPU
JaxLib version: 0.4.35
PyTorch is not installed
Cupy is not installed
Qiskit version: 1.2.4
Cirq version: 1.4.1
TensorCircuit version 0.12.0

@mkrompiec mkrompiec added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant