0
$\begingroup$

I have an error when I use Quantum SVM kernel algorithm from Qiskit aqua.

This is my code section with imports:

from qiskit.qobj import (QasmQobj, QobjExperimentHeader,
                         QasmQobjInstruction, QasmQobjExperimentConfig, QasmQobjExperiment,
                         QasmQobjConfig)

And here is the error I obtain:

ImportError: cannot import name 'QasmQobj' from 'qiskit.qobj' 
$\endgroup$
  • $\begingroup$ Qobj objects are usually bot needed by a end user. Why are you importing them? $\endgroup$ – Paul Nation Jul 2 at 11:14
  • 1
    $\begingroup$ Hi Zenab! Welcome to QCSE! Please make sure the title of your question is meaningful and not so overly broad as "Quantum Computing." Also, it's helpful if you actually have a question to ask, at least one questio-mark. It seems like your question is "can you help me with my error in Qiskit aqua?" Please make an effort to format your question properly. $\endgroup$ – Mark S Jul 2 at 11:54
  • $\begingroup$ To complete @MarkS comment, please include at least the outputs of python -V and python -m pip list. $\endgroup$ – Nelimee Jul 2 at 12:24
  • $\begingroup$ @Paul Nation, I don't import them , when I run project.py file to use QSVM, I have this error ImportError: cannot import name 'QasmQobj' from 'qiskit.qobj' without import them. $\endgroup$ – Zeinab Ali Jul 2 at 12:42
0
$\begingroup$

With the information you provided in your question, I recommand you to try to reinstall qiskit from scratch.

To do so, just execute

python -m pip install -U qiskit

I tried to execute your import statements after running this line, and it worked.

If you do not use the default python, replace python with the python executable you are using (e.g. python3). If you are on linux, which python will show you the executable hidden behind the python command.

If your problem is still here, please provide the output of the following commands (should always be provided in questions related to issues with python libraries):

python -V
python -m pip list
$\endgroup$
  • $\begingroup$ Dr. Nelimee, Python version (base) C:\Users\Dell>python -V Python 3.7.3 $\endgroup$ – Zeinab Ali Jul 2 at 13:01
  • $\begingroup$ Can you try python -m pip install -U --force-reinstall qiskit? This will force the reinstallation of your qiskit. $\endgroup$ – Nelimee Jul 2 at 13:08
  • $\begingroup$ Ok, I 'll try it $\endgroup$ – Zeinab Ali Jul 2 at 13:14
  • $\begingroup$ Dr. Nelimee, I did it this command python -m pip install -U --force-reinstall qiskit and show with me this error : cannot import name 'aqua_globals' from 'qiskit.aqua' $\endgroup$ – Zeinab Ali Jul 2 at 13:22
  • $\begingroup$ these packages of qiskit with versions after reinstallation--------------------->> qiskit 0.10.5 qiskit-aer 0.2.1 qiskit-aqua 0.5.2 qiskit-aqua-interfaces 0.1.0 qiskit-chemistry 0.5.0 qiskit-ibmq-provider 0.2.2 qiskit-ignis 0.1.1 qiskit-terra 0.8.2 $\endgroup$ – Zeinab Ali Jul 2 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.