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

from qiskit_ibm_runtime import QiskitRuntimeService throws an error #1331

Closed
shravanpatel30 opened this issue Jan 23, 2024 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@shravanpatel30
Copy link

Describe the bug
The command 'from qiskit_ibm_runtime import QiskitRuntimeService' throws an error:

import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Steps to reproduce

  1. I installed Python 3.12.1 on a new PC which had no python distribution on it.

  2. Then installed qiskit, and qiskit-ibm-runtime

  3. Now while trying to set-up my PC to use IBM Quantum Platform using API tokens I ran the below code (line by line in cmd):

    from qiskit_ibm_runtime import QiskitRuntimeService
    service = QiskitRuntimeService(channel="ibm_quantum", token="<MY_IBM_QUANTUM_TOKEN>")

  4. This is where I received an error:

    import pkg_resources
    ModuleNotFoundError: No module named 'pkg_resources'

Expected behavior

Suggested solutions
I'm guessing the error is caused because there is no pkg_resource package installed. So to get rid of the error install setuptools using pip install setuptools version 69.0.3. And we should include setuptools in dependencies so a first time user won't encounter this error.

Additional Information
I'm not using qiskit from a virutual environment

  • qiskit-ibm-runtime version: 0.17.0
  • Python version: 3.12.1
  • Operating system: Windows 11 Home 64-bit
@shravanpatel30 shravanpatel30 added the bug Something isn't working label Jan 23, 2024
@kt474
Copy link
Member

kt474 commented Jan 23, 2024

I believe there may be an issue with your python environment

setuptools should be installed by default with pip

@shravanpatel30
Copy link
Author

Yes, setuptools used to be pre-installed with pip. But in python version 3.12, devs made a change that distutils, setuptools, pkg_resources, and easy_install will no longer available by default. Here is the link for What's new in python 3.12, and under "Important deprecations, removals or restrictions" they have mentioned this change.

So when running from qiskit_ibm_runtime import QiskitRuntimeService on python 3.12 , an error is generated that module pkg_resources is not found. And to circumvent this error I think we should add setuptools to the dependencies.

@Muhammad-Raiyan
Copy link

Just wanted to mentioned I had the same issue and after doing pip install setuptools the issue was fixed. And I think this issue will be fixed with PR #1347

@kt474
Copy link
Member

kt474 commented Feb 22, 2024

Fixed in #1347

@kt474 kt474 closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants