Error connecting to IBMQ hardware

Hello! If applicable, put your complete code example down below. Make sure that your code:

  • is 100% self-contained — someone can copy-paste exactly what is here and run it to
    reproduce the behaviour you are observing
  • includes comments

Note: I have set the values for QISKIT_IBM_TOKEN and QISKIT_IBM_INSTANCE in the env and can connect and run code on IBMQ hardware
```

Put code here

import os
import pennylane as qml
from pennylane import numpy as np
from qiskit_ibm_runtime import QiskitRuntimeService

ibm_apikey=os.environ.get(“QISKIT_IBM_TOKEN”)
ibm_crn=os.environ.get(“QISKIT_IBM_INSTANCE”)

Obtain the backend

Load the Runtime primitive and session

from qiskit_ibm_runtime import SamplerV2 as Sampler

service = QiskitRuntimeService(channel=“ibm_quantum_platform”)

Use the least busy backend

backend = service.least_busy(operational=True, simulator=False, min_num_qubits = 127)

print(backend.name)

print(f"\n qml.about(): {qml.about()}")

Connect to IBM Quantum hardware backend

try:
dev = qml.device(
“qiskit.ibmq”,
wires=2,
shots=1024, # Number of times to run the circuit on hardware
backend=“backend_name”,
ibmqx_token=ibm_apikey,
instance=ibm_crn
)
print(f"\ninitialized PennyLane device for {backend.name}“)
except Exception as e:
print(f”\nError connecting to : {backend.name}")
print(“Connecting to local simulator”)
dev = qml.device(“default.qubit”, wires=2, shots=1024) # Fallback to local ideal simulator


If you want help with diagnosing an error, please put the full error message below:

Put full error message here

python .\pennylane-on-IBMQ.py
ibm_torino
Error connecting to : ibm_torino
Connecting to local simulator

And, finally, make sure to include the versions of your packages. Specifically, show us the output of `qml.about()`. 

Name: pennylane
Version: 0.42.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page:
Author:
Author-email:
License-Expression: Apache-2.0
Location: C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages
Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, tomlkit, typing_extensions
Required-by: pennylane_lightning

Platform info:           Windows-11-10.0.26100-SP0
Python version:          3.13.5
Numpy version:           2.2.6
Scipy version:           1.16.0
Installed devices:
- default.clifford (pennylane-0.42.0)
- default.gaussian (pennylane-0.42.0)
- default.mixed (pennylane-0.42.0)
- default.qubit (pennylane-0.42.0)
- default.qutrit (pennylane-0.42.0)
- default.qutrit.mixed (pennylane-0.42.0)
- default.tensor (pennylane-0.42.0)
- null.qubit (pennylane-0.42.0)
- reference.qubit (pennylane-0.42.0)
- lightning.qubit (pennylane_lightning-0.42.0)

 qml.about(): None

Hi @qage ,

Can you please share the full error traceback?

python .\pennylane-on-IBMQ.py
qiskit_runtime_service._resolve_cloud_instances:WARNING:2025-07-30 08:45:32,830: Default instance not set. Searching all available instances.

Backend name : ibm_torino
Traceback (most recent call last):
File “C:\Users\user1\Desktop\Gopi\python\PennyLane\pennylane-on-IBMQ.py”, line 38, in
dev = qml.device(
“qiskit.remote”,
…<2 lines>…
backend=“backend_name”
)
File “C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\pennylane\devices\device_constructor.py”, line 249, in device
plugin_device_class = plugin_devices[name].load()
File “C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\importlib\metadata_init_.py”, line 179, in load
module = import_module(match.group(‘module’))
File “C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\importlib_init_.py”, line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1387, in _gcd_import
File “”, line 1360, in find_and_load
File “”, line 1331, in find_and_load_unlocked
File “”, line 935, in load_unlocked
File “”, line 1026, in exec_module
File “”, line 488, in call_with_frames_removed
File "C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\pennylane_qiskit_init
.py", line 17, in
from .aer import AerDevice
File “C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\pennylane_qiskit\aer.py”, line 19, in
import qiskit_aer
File "C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\qiskit_aer_init
.py", line 69, in
from qiskit_aer.aerprovider import AerProvider
File “C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\qiskit_aer\aerprovider.py”, line 20, in
from .backends.aer_simulator import AerSimulator
File "C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\qiskit_aer\backends_init
.py", line 17, in
from .aer_simulator import AerSimulator
File “C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\qiskit_aer\backends\aer_simulator.py”, line 19, in
from qiskit.providers import convert_to_target
ImportError: cannot import name ‘convert_to_target’ from ‘qiskit.providers’ (C:\Users\user1\AppData\Local\Programs\Python\Python313\Lib\site-packages\qiskit\providers_init
.py)

Hi @qage , it looks like you have no “instance”, which is now required with the new IBM platform changes.

The info in this issue and the latest version of the docs should help you solve the issue.

I hope this helps!