# Error connecting to IBMQ hardware

**URL:** <https://discuss.pennylane.ai/t/error-connecting-to-ibmq-hardware/8828>\
**Category:** PennyLane Qiskit\
**Created:** [July 28, 2025, 6:52am UTC](https://discuss.pennylane.ai/t/error-connecting-to-ibmq-hardware/8828 "2025-07-28T06:52:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![qage](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/qage/32/3670_2.png) [@qage](https://discuss.pennylane.ai/u/qage)\
**Post date:** [July 28, 2025, 6:52am UTC](https://discuss.pennylane.ai/t/error-connecting-to-ibmq-hardware/8828/1 "2025-07-28T06:52:41Z")

</div>

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

```auto

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

```auto
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
```

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [July 29, 2025, 9:17pm UTC](https://discuss.pennylane.ai/t/error-connecting-to-ibmq-hardware/8828/2 "2025-07-29T21:17:18Z")

</div>

Hi @qage ,

Can you please share the full error traceback?

---

<div class="post-metadata">

**Author:** ![qage](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/qage/32/3670_2.png) [@qage](https://discuss.pennylane.ai/u/qage)\
**Post date:** [July 30, 2025, 3:23am UTC](https://discuss.pennylane.ai/t/error-connecting-to-ibmq-hardware/8828/3 "2025-07-30T03:23:48Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [July 30, 2025, 10:02pm UTC](https://discuss.pennylane.ai/t/error-connecting-to-ibmq-hardware/8828/4 "2025-07-30T22:02:52Z")

</div>

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

The info in [this issue](https://github.com/PennyLaneAI/pennylane-qiskit/issues/645) and the latest version of the [docs](https://docs.pennylane.ai/projects/qiskit/en/latest/) should help you solve the issue.

I hope this helps!
