Installation

Installing the Qwak SDK

In this quickstart guide, you'll learn how to deploy your first ML model on Qwak within minutes.

  1. Create a new virtual environment using your preferred Python framework, such as virtualenv, poetry or conda.
  2. Install the Qwak SDK in your virtual environment with the following command:
pip install qwak-sdk
poetry add qwak-sdk

This will install the Qwak SDK and CLI client, which you'll use to interact with the Qwak platform.

πŸ“˜

Mac M1 Users

If you are installing the Python SDK on a Mac with an M1 chip, do not install Rosetta. The SDK is compatible with the native M1 architecture.




Configuring the Qwak SDK

The first step in configuring your Qwak authentication is through a personal API key, and you have two options available:


1. Via Qwak CLI

Log in to Qwak and copy your API key from the settings page.

Open the terminal and type in the following command:

qwak configure

Paste your personal API key when prompted:

Please enter your API key:

Alternatively, configure the API key a single command.

Replace <YOUR_API_KEY> with your API key and ensure to wrap the token in double quotation marks:

qwak configure --api-key "<YOUR_API_KEY>"

After successfully configuring your API key, the below message will appear:

User succesfully configured

2. Via Environment Variable

Qwak also allows you to configure your session authentication key via environment variables. Please note that this is only relevant for the individual Terminal session or until the next computer restart.

To set the environment variable, use the following command:

export QWAK_API_KEY='<YOUR_API_KEY>'

πŸ“˜

The next time you run a Qwak CLI command, such as qwak models build, the authentication will prioritize the current environment variable over the configuration file.

The same behavior occurs when you're running Python code that calls the Qwak SDK; it will read the environment variable for authentication.


Configuring for Multiple Environments

If your organization uses Qwak in a multi-environment setup, such as staging and prod for example, you may need to specify which environment Qwak should use when executing commands. To achieve this, you can manually configure your Qwak authentication config file to allow for environment selection at runtime.

Follow these steps:

1. Locate the Qwak Configuration File

Find and edit your configuration file, which is typically located at ~/.qwak/config.


2. Default Configuration

After running the qwak configure command, your configuration file will initially look like this:

[default]
api_key = <YOUR_API_KEY>

By default, Qwak will use the environment associated with this API key when executing commands.


3. Specifying the Environment at Runtime

However, there are scenarios where you want to specify the environment when running commands, as shown in the example below:

qwak models build --model-id 'some_model' --environment 'staging' .

If your .qwak/config file is only configured with a [default] section, you'll encounter an error when trying to specify an environment as shown above.

To handle this scenario, update your configuration file to include sections for each environment, like this:

[default]
api_key = <YOUR_DEFAULT_ENV_API_KEY>

[staging]
api_key = <YOUR_QWAK_API_KEY_FOR_STAGING>

[prod]
api_key = <YOUR_QWAK_API_KEY_FOR_PROD>

Now, you can specify the environment when running commands, and Qwak will use the corresponding API key from your configuration.

To create a key for a specific environment, please select that environment by its name in your Qwak UI during the API key creation process.




Troubleshooting

Unrecognized qwak Command

If your local system fails to recognize the qwak command, ensure it's added to your system's PATH environment variable.


Read/Write Permission Issues

Should you face issues related to read/write permissions with the following error message:

Could not read user configuration from <home_path>/.qwak/config. Please make sure one has been set using qwak configure command.

Manually create the .qwak directory in your home path and rerun the configure command:

mkdir -p <home_path>/.qwak

Additional Troubleshooting

_For any other issues with installing and configuring your Qwak SDK please refer to Installation Issues or Performance Issues pages.


What’s Next

Learn How to Build and Deploy Your First ML Model on Qwak.