# Quickstart

A crash course on using the PlanQK Platform to run an entire Quantum workflow, from development to deployment 🚀.

# Installation

# 1. Create an account

If you don't have one yet, create an account (opens new window)

# 2. Install the PlanQK CLI

To install the PlanQK CLI, you must install Node.js and the npm command line interface using either a Node version manager (opens new window) or a Node installer (opens new window).

Then install the PlanQK CLI globally using npm:

npm install -g @anaqor/planqk
1

For details read the CLI reference.

# 3. Login to your account

planqk login -t <your access token>
1

# Create your first project

Create your first project by running the following command:

planqk init
1

You will be prompted to provide some information about your project configuration. For this quickstart, select the following configuration:

  • Name: my-project
  • Template: IonQ Starter (Cloud Simulator)
  • vCPU: 0.5 vCPU
  • Memory: 1GB

TIP

Access to IonQ's quantum simulator is available in basic accounts. At least a pro account is required, if you want to use IonQ QPUs or other quantum hardware.

This will create a new directory called my-project containing all required files to run your quantum code on the PlanQK Platform. The starter templates implement quantum random number generation using either the IonQ Simulator or the Qiskit Aer Simulator. You can find a detailed description of the templates in this GitHub repository (opens new window). It also contains a planqk.json file, which contains the project configuration. The file should look like this:

{
  "name": "my-project",
  "description": "<your project description>",
  "resources": {
    "cpu": 0.5,
    "memory": 1
  },
  "runtime": "PYTHON_TEMPLATE"
}
1
2
3
4
5
6
7
8
9

# Test your service locally

Let's test your service locally before deploying it to the PlanQK Platform. First, switch to your project directory:

cd my-project
1

Then, install the required dependencies. We recommend using a dedicated conda (opens new window) environment. As an alternative, you can use the requirements.txt to install the dependencies with the tooling of your choice.

With conda run:

conda env create -f environment.yml
conda activate my-project
1
2

Finally, run your service locally:

python -m src
1

The output should look like this:

{
  "result": {
    "random_number": 216
  },
  "metadata": {
    "execution_time": 9.327
  }
}
1
2
3
4
5
6
7
8

# Test your service locally with PlanQK CLI

To begin, navigate to your project directory:

cd my-project
1

Next, run the following command:

planqk serve
1

Once the server is operational, you can access http://localhost:8081/docs. This interface provides you the ability to manage service executions via the API. Further information can be found in the documentation planqk serve (opens new window).

# Deploy your service

Deploy your service to the PlanQK Platform. Within your project directory, run:

planqk up
1

This will build your service, deploy it, and make it accessible to you via a REST API.

# Execute your service

Execute your service with the example input data by running the following command:

planqk run 
1

After a successful execution, the output should look like this:

Running Job (a7a3422b-9522-408b-96c9-32cdb497b12b)... Job succeeded.
See result at https://platform.planqk.de/jobs/a7a3422b-9522-408b-96c9-32cdb497b12b
1
2

As a default, the input data and params are read from the input.json and params.json file contained in the input directory in your project.

You can also provide the input data and params as command line flags:

planqk run -d '{"values": [10,12]}' -p '{"round_up": true}'
1

For more details and options see the CLI reference.

# What's next?