Install Qiskit (Ubuntu 22.04)

  1. Make sure you have python3 command available.
  2. Create a directory. mkdir qiskit-project
  3. Run the following command, you may need to install python3.10-venv package.
    python3 -m venv qiskit-project/
  4. Activate your new environment.
    source qiskit-project/bin/activate Now your terminal prompt should be prefixed by "(qiskit-project)".
  5. Use pip to install qiskit.
    pip install qiskit
  6. Use pip to install qiskit runtime.
    pip install qiskit-ibm-runtime You can run pip list to see the active packages in your virtual environment.

Run Qiskit code on IBM's simulators (Ubuntu 22.04)

Note that we assume you have an account with IBM and your terminal is still in the virtual environment.
  1. Open up python interpreter. python3
  2. Enter the following command in the interpreter. Please replace "<MY_IBM_QUANTUM_TOKEN>" with your actual token.
    from qiskit_ibm_runtime import QiskitRuntimeService QiskitRuntimeService.save_account(channel="ibm_quantum", token="<MY_IBM_QUANTUM_TOKEN>", set_as_default=True) service = QiskitRuntimeService() quit() Your credentials will be saved to $HOME/.qiskit/qiskit-ibm.json. Next time you can use QiskitRuntimeService() to initialize your account.
  3. Download the this python file and run it with the following command. python3 bell.py If everything is setting up correctly, you should see a printed ascii circuit for bell00 state, and an output like {'00': 0.4845, '11': 0.5155}, which is the output of IBM's simulator.

Note