Instructions can be found at the Qiskit IBM Runtime repository.
We assume that git is installed. As a first step, clone the repository and enter the clone's directory:
$ git clone https://github.com/mberna/qce22-qiskit-runtime-tutorial.git
$ cd qce22-qiskit-runtime-tutorial
The remainder of this document will assume you are in the root directory of the repository.
Next, we assume that Python 3.8 or higher is installed. It is recommended to use a Python virtual environment that is dedicated to working with this repo. The steps in the remainder of this document will assume that this environment is activated using either method.
You can create and activate a virtual environment with the following commands:
$ python3 -m venv venv
$ source venv/bin/activate
The first command creates a virtual environment in the venv
folder of the current directory. We recommend using this name, as it will be ignored by git (i.e., we have added it to .gitignore
).
Any time you open a new shell and wish to work with this repo, you will need to activate it using the second line above. (If you prefer that the virtual environment be activated automatically any time you enter the directory, you may wish to look into using direnv or a similar tool.)
The following commands create and activate a conda virtual environment named qiskit_runtime_env
:
$ conda create -n qiskit_runtime_env python=3.8
$ conda activate qiskit_runtime_env
Any time you open a new shell and wish to work with this repo, you will need to activate it using the second line above.
All of the packages needed for this tutorial can be installed by running:
$ pip install -r requirements.txt
Run the hello_world.py
script to verify your installation:
$ python3 ./docs/hello_world.py
This script will prompt you for your IBM Quantum token, unless you had previously saved it on disk.
Once finished, the script will print Hello, World!
. It may take a minute or two for the script to complete.
Jupyter should already be installed into the virtual environment if you ran the command in the previous step.
Then, start the notebook server. From the root directory:
$ jupyter notebook
Make sure the notebook server is started from the same Python environment (venv or conda) from which you ran pip install -r requirements.txt
; otherwise, it may not find this repo in the path.
Once the notebook server starts, it will provide a URL for accessing it through your web browser. The tutorial notebooks can be found in the docs directory.