# What is Qconfig in QISKit and how do I set it up?

To use certain things in QISKIt, such as acessing the real quantum processors, it seems that there is a file 'Qconfig.py'. That needs to be set up.

How do I do this?

To get access to the real devices and remote simulators, you need to have an account with the IBM Q Experience. Once you do, you can get your API key from the account page.

Once you have the API key, you can set up a Qconfig file. Let's assume that you want to run things from the QISKit tutorial. The Qconfig file can then be set up by editing the file located here.

You just need to replace the line

APItoken = None


with

APItoken = "randomstringoflettersandnumbersyoucopiedfromthewebsite"


Where the stuff within the quotation marks should be your actual API token.

You also need to rename the file from 'Qconfig.py.template' to just Qconfig.py.

Now you need to import the information from this file in your programs. This will depend on where you program sits in your computer relative to the Qconfig file.

If the .py or .ipynb file containing your program is sitting in the same directory as 'Qconfig.py', you can import with just

import Qconfig
qx_config = {
"APItoken": Qconfig.APItoken,
"url": Qconfig.config['url']}


except Exception as e: print(e) qx_config = { "APItoken":"YOUR_TOKEN_HERE", "url":"https://quantumexperience.ng.bluemix.net/api"}

and then register your connection to the API with

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

If your .py or .ipynb is one directory level down, such as for this you'll need to have the lines

import sys
sys.path.append("../")


before you try to import. This tells the program to look for the Qconfig file in the directory above instead.