Setup#

In this short section we cover how you can install the fermioniq package and configure your user credentials.

Installation#

Before installing the fermioniq package, make sure that you have met the following requirements:

  • You have a working installation of Python 3.10

  • You have installed the pip package manager

It is also recommended to install the package into a virtual environment, although not strictly necessary. The package fermioniq can be installed with the following commands:

pip install fermioniq

Configuration#

Submitting jobs requires a user specific access_token_id and access_token_secret which are tied to your Fermioniq account. These are used for authenticating the jobs you send. There are two ways of providing these access tokens to the client, either as environment variables or as arguments when instantiating the client.

You can set the access tokens as environment variables in your shell.

export FERMIONIQ_ACCESS_TOKEN_ID="<your access token id>"
export FERMIONIQ_ACCESS_TOKEN_SECRET="<your access token secret>"

When initializing the client, the access tokens will be read from the environment variables by default:

You can also pass the ID and secret as arguments when instantiating the Client() within a Python script. It is recommended to not write the access tokens directly in the script, but to read them from a file. For example, by storing the contents below in a file fermioniq_access_token.json:

{
    "access_token_id": "<your access token id>",
    "access_token_secret": "<your access token secret>"
}

you can then easily initialize the client as follows:

import json
from fermioniq.client import Client

with open('fermioniq_access_token.json', 'r') as f:
    access_tokens = json.load(f)

client = Client(
    access_token_id = access_tokens['access_token_id'],
    access_token_secret = access_tokens['access_token_secret']
)

Warning

Do not share your access tokens with anyone. They are tied to your Fermioniq account and should be kept secret. If you are working on a project with multiple collaborators, consider adding the access tokens to a .gitignore file to avoid accidentally sharing them.

Getting Access#

If you don’t have a Fermioniq account but would like to get access to our services, please email or visit the Fermioniq website

Notifications#

It is possible to receive an email or Slack notification when your job is finished, with details about your job. There are two options for specifying your notification details:

  1. Set your email address and/or Slack ID (see below how to obtain this) as environment variables in your shell:

    export SLACK_ID="<your slack id>"
    export EMAIL_ADDRESS="<your email address>"
    
  2. Configure your email address and/or Slack ID using the configure_notifications() method of the client. This will save your details so they can be used everytime you initialize the client with your tokens. When calling this method, test messages will be sent using the specified details and return errors if they occur. This is useful for identifying any issues with notifications if you are not receiving them.

    from fermioniq.client import Client
    
    client = Client()
    client.configure_notifications(email_address="example@domain.com", slack_id="ABC123")
    

    These details can be updated any time by rerunning the code block above.

Notifications can be turned on for a job by specifying the notification mode (“slack” or “email”) when creating an emulator job. See the tutorials in the next section for more information about creating and sending jobs.

from fermioniq.client import Client

client = Client()
emulator_job = fermioniq.EmulatorJob(circuit=circuit, notification_mode="slack")

Set up Slack notifications#

In order to receive notifications in Slack, you need to add our Fermioniq JobNoti app to your workspace:

orphan:

Add to Slack

Note

You can find your Slack ID as follows:

  1. In your Slack workspace, click on your profile name or picture located at the bottom-left corner of the Slack interface.

  2. In the dropdown menu, click on “Profile” (or “View Profile”).

  3. Click the ellipses (three dots).

  4. Click on “Copy Member ID”. This is your Slack ID.