Qiskit / qiskit-aer

Aer is a high performance simulator for quantum circuits that includes noise models
https://qiskit.github.io/qiskit-aer/
Apache License 2.0
505 stars 361 forks source link

Cannot import AerSimulator #1973

Open giacomotaba opened 1 year ago

giacomotaba commented 1 year ago

Informations

What is the current behavior?

File c:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\qiskit_aer__init__.py:69 65 np.dot(np.zeros(100), np.zeros(100)) 66 # ... ¯_(ツ)_/¯ 67 68 # pylint: disable=wrong-import-position ---> 69 from qiskit_aer.aerprovider import AerProvider 70 from qiskit_aer.jobs import AerJob, AerJobSet 71 from qiskit_aer.aererror import AerError

File c:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\qiskit_aer\aerprovider.py:20 17 from qiskit.providers import ProviderV1 as Provider 18 from qiskit.providers.providerutils import filter_backends ---> 20 from .backends.aer_simulator import AerSimulator 21 from .backends.qasm_simulator import QasmSimulator 22 from .backends.statevector_simulator import StatevectorSimulator

File c:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\qiskit_aer\backends__init__.py:17 1 # This code is part of Qiskit. 2 # 3 # (C) Copyright IBM 2018, 2019. (...) 10 # copyright notice, and modified files need to carry a notice indicating 11 # that they have been altered from the originals. 13 """ 14 Aer Provider Simulator Backends 15 """ ---> 17 from .aer_simulator import AerSimulator 18 from .qasm_simulator import QasmSimulator 19 from .statevector_simulator import StatevectorSimulator

File c:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\qiskit_aer\backends\aer_simulator.py:24 21 from qiskit.transpiler.target import target_to_backend_properties 23 from ..version import version ---> 24 from .aerbackend import AerBackend, AerError 25 from .backend_utils import ( 26 cpp_execute_circuits, 27 cpp_execute_qobj, (...) 31 BASIS_GATES, 32 ) 34 # pylint: disable=import-error, no-name-in-module, abstract-method

File c:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\qiskit_aer\backends\aerbackend.py:36 34 from ..noise.noise_model import NoiseModel, QuantumErrorLocation 35 from ..noise.errors.quantum_error import QuantumChannelInstruction ---> 36 from .aer_compiler import compile_circuit, assemble_circuits, generate_aer_config 37 from .backend_utils import format_save_type, circuit_optypes 38 from .name_mapping import NAME_MAPPING

File c:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\qiskit_aer\backends\aer_compiler.py:45 42 from qiskit_aer.noise import NoiseModel 44 # pylint: disable=import-error, no-name-in-module ---> 45 from qiskit_aer.backends.controller_wrappers import ( 46 AerUnaryExpr, 47 AerUnaryOp, 48 AerBinaryExpr, 49 AerBinaryOp, 50 AerUintValue, 51 AerBoolValue, 52 AerUint, 53 AerBool, 54 AerCast, 55 AerVar, 56 AerCircuit, 57 AerConfig, 58 ) 60 from .backend_utils import circuit_optypes 61 from ..library.control_flow_instructions import AerMark, AerJump ImportError: DLL load failed while importing controller_wrappers: Impossibile trovare il modulo specificato.

Steps to reproduce the problem

Trying a demo script in a notebook python. As soon as I added the import of AerSimulator it throws this error. Tried with qsikit-aer 0.12 version too. Tried with python 3.11.0 too.

JorjaKirk commented 1 month ago

I am currently facing this same issue

qiskit-aer version: 0.15.1 Python version: 3.11 OS: Windows 11

Error:


ImportError Traceback (most recent call last) Cell In[10], line 7 4 import numpy as np 6 from qiskit import QuantumCircuit, transpile ----> 7 from qiskit_aer import AerSimulator 8 from qiskit.visualization import plot_histogram

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskitaer__init_.py:69 65 np.dot(np.zeros(100), np.zeros(100)) 66 # ... ¯\(ツ)/¯ 67 68 # pylint: disable=wrong-import-position ---> 69 from qiskit_aer.aerprovider import AerProvider 70 from qiskit_aer.jobs import AerJob 71 from qiskit_aer.aererror import AerError

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\aerprovider.py:20 17 from qiskit.providers import QiskitBackendNotFoundError 18 from qiskit.providers.providerutils import filter_backends ---> 20 from .backends.aer_simulator import AerSimulator 21 from .backends.qasm_simulator import QasmSimulator 22 from .backends.statevector_simulator import StatevectorSimulator

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\backends__init__.py:17 1 # This code is part of Qiskit. 2 # 3 # (C) Copyright IBM 2018, 2019. (...) 10 # copyright notice, and modified files need to carry a notice indicating 11 # that they have been altered from the originals. 13 """ 14 Aer Provider Simulator Backends 15 """ ---> 17 from .aer_simulator import AerSimulator 18 from .qasm_simulator import QasmSimulator 19 from .statevector_simulator import StatevectorSimulator

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\backends\aer_simulator.py:24 21 from qiskit.providers.backend import BackendV2, BackendV1 23 from ..version import version ---> 24 from .aerbackend import AerBackend, AerError 25 from .backendconfiguration import AerBackendConfiguration 26 from .backendproperties import target_to_backend_properties

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\backends\aerbackend.py:33 31 from ..aererror import AerError 32 from ..jobs import AerJob ---> 33 from ..noise.noise_model import NoiseModel, QuantumErrorLocation 34 from ..noise.errors.base_quantum_error import QuantumChannelInstruction 35 from .aer_compiler import compile_circuit, assemble_circuits, generate_aer_config

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\noise__init__.py:241 13 r""" 14 ================================================ 15 Noise Models (:mod:qiskit_aer.noise) (...) 237 device.thermal_relaxation_values 238 """ 240 # Noise and Error classes --> 241 from .noise_model import NoiseModel 242 from .errors import QuantumError 243 from .errors import PauliError

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\noise\noise_model.py:38 36 from .noiseerror import NoiseError 37 from .passes import RelaxationNoisePass ---> 38 from ..backends.backend_utils import BASIS_GATES 40 logger = logging.getLogger(name) 43 class AerJSONEncoder(json.JSONEncoder):

File ~\PycharmProjects\qaoa.venv\Lib\site-packages\qiskit_aer\backends\backend_utils.py:30 27 from .compatibility import Statevector, DensityMatrix, StabilizerState, Operator, SuperOp 29 # pylint: disable=import-error, no-name-in-module, abstract-method ---> 30 from .controller_wrappers import aer_initialize_libraries 32 # Available system memory 33 SYSTEM_MEMORY_GB = psutil.virtual_memory().total / (1024**3)

ImportError: DLL load failed while importing controller_wrappers: The specified module could not be found.