Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'qiskit.providers.aer' despite successful installation #2268

Open
rcaldas08 opened this issue Nov 25, 2024 · 2 comments

Comments

@rcaldas08
Copy link

Summary
I am encountering a ModuleNotFoundError for qiskit.providers.aer despite successfully installing qiskit-aer. I followed the standard installation procedures and verified the presence of the qiskit-aer package in the site-packages directory. The issue persists across different environments and configurations.

Environment Details
Operating System: Windows 10 (provide exact version if known)
Python Version: Python 3.9.20
Qiskit Version: 1.2.4
Qiskit-Aer Version: 0.15.1
Package Manager: pip 24.2
Conda: Yes (environment used: fresh_env)
Steps to Reproduce
Create a new virtual environment:

conda create -n fresh_env python=3.9
conda activate fresh_env
Install qiskit and qiskit-aer:

pip install qiskit qiskit-aer
Attempt to import AerSimulator:

python
from qiskit.providers.aer import AerSimulator
simulator = AerSimulator()
print("AerSimulator is working!")
Observe the error:

vbnet
ModuleNotFoundError: No module named 'qiskit.providers.aer'
Observed Behavior
The qiskit and qiskit-aer packages are listed as installed:

pip show qiskit qiskit-aer
Output:

vbnet
Copy code
Name: qiskit
Version: 1.2.4
Location: C:\Users<user>\AppData\Local\anaconda3\envs\fresh_env\lib\site-packages

Name: qiskit-aer
Version: 0.15.1
Location: C:\Users<user>\AppData\Local\anaconda3\envs\fresh_env\lib\site-packages
The aer module is missing from the qiskit.providers directory:

dir C:\Users<user>\AppData\Local\anaconda3\envs\fresh_env\Lib\site-packages\qiskit\providers\aer
Output:

mathematica
File Not Found
Even after reinstalling, the issue persists.

Expected Behavior
The AerSimulator module should load without errors, as follows:

python
from qiskit.providers.aer import AerSimulator
print("AerSimulator initialized successfully!")
What I Tried
Reinstalled Qiskit and Qiskit-Aer:

pip uninstall qiskit qiskit-aer -y
pip install qiskit qiskit-aer
Verified Installation Paths:

pip show qiskit-aer
Cleared Pip Cache:

pip cache purge
Manually Checked for the Module:

dir C:\Users<user>\AppData\Local\anaconda3\envs\fresh_env\Lib\site-packages\qiskit\providers\aer
Created a Fresh Environment:

conda create -n new_env python=3.9
conda activate new_env
pip install qiskit qiskit-aer
Manually Cloned and Built Qiskit-Aer:

git clone https://github.com/Qiskit/qiskit-aer.git
cd qiskit-aer
python setup.py install
Verified Dependencies: Installed all required dependencies (rustworkx, numpy, scipy) explicitly.

Error Logs
Here’s the Python traceback:

vbnet
ModuleNotFoundError: No module named 'qiskit.providers.aer'
Screenshots
Directory Structure:

site-packages\qiskit\providers directory does not include aer.

![providers directory screenshot](attach the screenshot you shared previously)

site-packages contains both qiskit and qiskit-aer.

![site-packages screenshot](attach another screenshot you shared previously)

Additional Notes
I have successfully tested qiskit-ibm-runtime and other Qiskit modules. This issue appears isolated to qiskit-aer.
I believe this could be a packaging issue or a hidden dependency conflict. Any insights would be appreciated.
Request
Please help diagnose the root cause of this issue. If necessary, provide additional logs or debugging steps. Thank you! R

@jakelishman
Copy link
Member

qiskit.providers.aer was deprecated years ago and removed about a year ago. You should access Qiskit Aer and all its components through import qiskit_aer.

@rcaldas08
Copy link
Author

Thanks. I know. I am downloading qiskit-aer 0.15.0. But when the installation is complete, the qiskit-aer file that is supposed to be located inside the qiskit providers folders is created outside. I tried to move it inside the provider's file, but it didn't work. Something needs to be fixed to locate the file in the right place. I create sterile environments, uninstall and install it using all procedures I know, and nothing works. I even run a manual forensic inspection of all files to see if there are some traces in other folders, but nothing works.

qiskit.providers.aer was deprecated years ago and removed about a year ago. You should access Qiskit Aer and all its components through import qiskit_aer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants