admin管理员组

文章数量:1241080

I was trying to import QuantumKernals using the following:

from qiskit_machine_learning.kernels import QuantumKernel

but i am getting this error:

 from qiskit_machine_learning.kernels import QuantumKernel
ImportError: cannot import name 'QuantumKernel' from 'qiskit_machine_learning.kernels' 
(C:\Users\pshre\AppData\Local\Programs\Python\Python310\lib\site-packages\qiskit_machine_learning\kernels\__init__.py)

Qiskit version: 0.8.2

i have updated the module:

pip install --upgrade qiskit-machine-learning

I was trying to import QuantumKernals using the following:

from qiskit_machine_learning.kernels import QuantumKernel

but i am getting this error:

 from qiskit_machine_learning.kernels import QuantumKernel
ImportError: cannot import name 'QuantumKernel' from 'qiskit_machine_learning.kernels' 
(C:\Users\pshre\AppData\Local\Programs\Python\Python310\lib\site-packages\qiskit_machine_learning\kernels\__init__.py)

Qiskit version: 0.8.2

i have updated the module:

pip install --upgrade qiskit-machine-learning
Share Improve this question asked 2 days ago ShreyansuShreyansu 1 New contributor Shreyansu is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 0

There is no class named QuantumKernel, hence the error.

See the API ref https://qiskit-community.github.io/qiskit-machine-learning/apidocs/qiskit_machine_learning.kernels.html#module-qiskit_machine_learning.kernels for the classes that are there.

Also see the tutorials such as this one for quantum kernels https://qiskit-community.github.io/qiskit-machine-learning/tutorials/03_quantum_kernel.html

本文标签: machine learningQiskit ImportErrorStack Overflow