Shreyansu
Shreyansu

Reputation: 1

Qiskit ImportError

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

Upvotes: -1

Views: 52

Answers (2)

silent
silent

Reputation: 1

You could try this version: qiskit==0.44.0 qiskit-machine-learning==0.6.1

Upvotes: 0

Steve Wood
Steve Wood

Reputation: 356

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

Upvotes: 0

Related Questions