4
$\begingroup$

I am using Jupyter notebook to write and running my qiskit codes (python 3.6) and every time I encounter the message: LookupError: backend "ibmqx4" is not found, right now the ibmqx4 computer is not in maintenance and it running well.

I tried to regenerate Apitoken in the advanced option and make correspondingly the file Qconfig.py but the message still appears.

look at the example for a code that I write:

import numpy as np
import matplotlib.pyplot as plt
import qiskit as qk
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, register


import Qconfig



    batch = []
n=50
t=450
// we defining n similar quantum circuits
for j in range(1,n+1):
    q = QuantumRegister(1)
    c = ClassicalRegister(1)
    qc = QuantumCircuit(q, c)
    qc.x(q)
    qc.barrier()


// we decide the pausing time of the system be t*Gate Time
    for i in range(t):
        qc.iden(q)
    qc.measure(q,c)    
   //we append every circuit we create to batch so batch is like a list of n 
  circuits
    batch.append(qc)

// we executing all the n circuits and for each we run 1024 shots
shots = 1024
job = execute(qc,'ibmqx4',shots=shots)

and I get the output from the last row:

---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
<ipython-input-38-a89f2171589f> in <module>()
      1 # we executing all the n circuits and for each we run 1024 shots
      2 shots = 1024
----> 3 job = execute(qc,'ibmqx4',shots=shots)

~\Anaconda3\envs\QISKit\lib\site-packages\qiskit\wrapper\_wrapper.py in execute(circuits, backend, config, basis_gates, coupling_map, initial_layout, shots, max_credits, seed, qobj_id, hpc, skip_transpiler)
    270     # pylint: disable=missing-param-doc, missing-type-doc
    271     if isinstance(backend, str):
--> 272         backend = _DEFAULT_PROVIDER.get_backend(backend)
    273     qobj = compile(circuits, backend,
    274                    config, basis_gates, coupling_map, initial_layout,

~\Anaconda3\envs\QISKit\lib\site-packages\qiskit\wrapper\defaultqiskitprovider.py in get_backend(self, name)
     29 
     30     def get_backend(self, name):
---> 31         name = self.resolve_backend_name(name)
     32         for provider in self.providers:
     33             try:

~\Anaconda3\envs\QISKit\lib\site-packages\qiskit\wrapper\defaultqiskitprovider.py in resolve_backend_name(self, name)
    218 
    219         if resolved_name not in available:
--> 220             raise LookupError('backend "{}" not found.'.format(name))
    221 
    222         return resolved_name

LookupError: backend "ibmqx4" not found.

please help me to solve this repetitive bug...

$\endgroup$

1 Answer 1

2
$\begingroup$

I got it, there is need to add two codes :

the first one in the begining before starting programming:

import  sys,,  time,,  getpass
try:
    sys.path.append("../../") # go to parent dir
    import Qconfig
    qx_config = {
        "APItoken": Qconfig.APItoken,
        "url": Qconfig.config['url']}
    print('Qconfig loaded from %s.' % Qconfig.__file__)
except:
    APItoken = getpass.getpass('Please input your token and hit enter: ')
    qx_config = {
        "APItoken": APItoken,
        "url":"https://quantumexperience.ng.bluemix.net/api"}
    print('Qconfig.py not found in qiskit-tutorial directory; Qconfig loaded using user input.')

the second one is before execution:

register(qx_config['APItoken'], qx_config['url'])

hope I helped anyone with similar error!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.