Error while importing IBMQ

I have installed the pennylane-qiskit plugin but when I import IBMQ from qiskit, I get the following error:


ValueError Traceback (most recent call last)
in
----> 1 from qiskit import IBMQ

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/init.py in
55 # Try to import the Aer provider if installed.
56 try:
—> 57 from qiskit.providers.aer import Aer
58 except ImportError:
59 suppress_warnings = os.environ.get(‘QISKIT_SUPPRESS_PACKAGING_WARNINGS’, ‘’)

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/init.py in
62
63 # pylint: disable=wrong-import-position
—> 64 from .aerprovider import AerProvider
65 from .aerjob import AerJob
66 from .aererror import AerError

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/aerprovider.py in
21 from .backends.statevector_simulator import StatevectorSimulator
22 from .backends.unitary_simulator import UnitarySimulator
—> 23 from .backends.pulse_simulator import PulseSimulator
24
25

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/backends/init.py in
18 from .statevector_simulator import StatevectorSimulator
19 from .unitary_simulator import UnitarySimulator
—> 20 from .pulse_simulator import PulseSimulator

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/backends/pulse_simulator.py in
24 from …version import version
25 from …aererror import AerError
—> 26 from …pulse.controllers.pulse_controller import pulse_controller
27 from …pulse.system_models.pulse_system_model import PulseSystemModel
28 from .aerbackend import AerBackend

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/init.py in
50 from .qutip_extra_lite.cy import pyxbuilder as pbldr
51
—> 52 from .system_models.duffing_model_generators import duffing_system_model
53 from .system_models.pulse_system_model import PulseSystemModel
54

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/system_models/duffing_model_generators.py in
19 from collections.abc import Iterable
20 from qiskit.providers.models.backendconfiguration import UchannelLO
—> 21 from .hamiltonian_model import HamiltonianModel
22 from .pulse_system_model import PulseSystemModel
23

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/system_models/hamiltonian_model.py in
20 import numpy.linalg as la
21 from …aererror import AerError
—> 22 from .string_model_parser.string_model_parser import HamiltonianParser
23
24

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/system_models/string_model_parser/string_model_parser.py in
21 import numpy as np
22 from .apply_str_func_to_qobj import apply_func
—> 23 from .qobj_from_string import gen_oper
24
25

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/system_models/string_model_parser/qobj_from_string.py in
16 “”“Module for creating quantum operators.”""
17
—> 18 from …qutip_extra_lite import qobj_generators
19
20

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/qutip_extra_lite/qobj_generators.py in
17
18 import numpy as np
—> 19 from . import operators as ops
20 from . import states as st
21 from . import tensor as ten

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/qutip_extra_lite/operators.py in
54
55 import numpy as np
—> 56 from .fastsparse import fast_csr_matrix, fast_identity
57 from .qobj import Qobj
58

~/opt/anaconda3/lib/python3.7/site-packages/qiskit/providers/aer/pulse/qutip_extra_lite/fastsparse.py in
438 # -------------------------------------
439 # pylint: disable=no-name-in-module, wrong-import-position, import-error
–> 440 from .cy.spmath import (zcsr_transpose, zcsr_adjoint, zcsr_mult)

spmath.pyx in init qiskit.providers.aer.pulse.qutip_extra_lite.cy.spmath()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

I don’t know what might be the problem exactly. Please help.

Hi @kabirkhanna85!

This sounds like the same issue from this post over at StackOverflow: https://stackoverflow.com/questions/66193302/qiskit-error-numpy-ndarray-size-changed-may-indicate-binary-incompatibility

Could you try upgrading your NumPy version to 1.20, and see if that resolves the issue?

Thanks @josh ! It helped to resolve the issue. Here’s another issue I have raised. It would be great if you could have a look at it.

Thanks @kabirkhanna85, we have responded.