Setting Up the ASK SDK
This guide describes how to install the ASK SDK for Python in preparation for developing an Alexa skill.
Prerequisites
The ASK SDK for Python requires Python 3 (>= 3.8). Before continuing, make sure you have a supported version of Python installed. To show the version, from a command prompt run the following command:
$ python --version
Python 3.8
You can download the latest version of Python here.
Adding the ASK SDK for Python to your project
You can download and install the ASK SDK for Python from the Python Package Index (PyPI) by using the command line tool pip
. For Python version 3.8 or later, pip
is installed with Python by default.
A Python virtual environment is an isolated environment that helps manage project dependencies and package versions. If you prefer to work in a virtual environment, install the SDK in a virtual environment. For more details, see Set up the SDK in a virtual environment.
Another option is to install the ASK SDK for Python to a specific folder. This option ensures that you have the required dependencies and makes it easy to locate and deploy the required files for your finished skill. For more details, see Set up the SDK in a specific folder.
ask-sdk
lets you quickly get up and running with the SDK. It includes the core SDK package, the model package, and the package for the Amazon DynamoDB persistence adapter that enables storing skill attributes in DynamoDB.If you don't need everything in the standard distribution
ask-sdk
, you can install the core package and expand with individual add-on packages later.For doing that, change the package name in the
pip install <package name>
commands in the following sections with ask-sdk-core
for the core package and ask-sdk-dynamodb-persistence-adapter
for the DynamoDB persistence adapter add-on.Option 1: Set up the SDK in a virtual environment
This option requires you to install the virtualenv
package. virtualenv
is a tool to create isolated Python environments. To get started, from a command prompt, use the following command to install the package:
$ pip install virtualenv
Next, create a new folder for your Alexa skill and navigate to the folder:
$ mkdir skill
$ cd skill
Next, create a virtual environment called skill_env
by issuing the following command:
$ virtualenv skill_env
Next, activate your virtual environment and install the SDK.
Run the following command to activate your virtual environment:
$ source skill_env/bin/activate
The command prompt should now be prefixed with (skill_env), indicating that you are working inside the virtual environment. Use the following command to install the ASK Python SDK:
(skill_env)$ pip install ask-sdk
Depending on the version of Python you are using, the SDK will be installed into the skill_env/lib/Python3.6/site-packages
folder. The site-packages folder is populated with directories including:
ask_sdk
ask_sdk_core
ask_sdk_dynamodb
ask_sdk_model
boto3
...
Run the following command to activate your virtual environment:
$ skill_env\Scripts\activate
The command prompt should now be prefixed with (skill_env), indicating that you are working inside the virtual environment. Use the following command to install the ASK Python SDK:
(skill_env)$ pip install ask-sdk
The SDK will be installed into the skill\Lib\site-packages
folder. The site-packages folder is populated with directories including:
ask_sdk
ask_sdk_core
ask_sdk_dynamodb
ask_sdk_model
boto3
...
Option 2: Set up the SDK in a specific folder
To get started, from a command prompt create a new folder for your Alexa skill and navigate to the folder:
$ mkdir skill
$ cd skill
Next, install the ASK SDK for Python using pip. The -t
option targets a specific folder for installation:
$ pip install ask-sdk -t skill_env
This creates a folder named skill_env
inside your skill
folder and installs the ASK SDK for Python and its dependencies. Your skill
directory should now contain the folder skill_env
, which is populated with directories including:
ask_sdk
ask_sdk_core
ask_sdk_dynamodb
ask_sdk_model
boto3
...
setup.cfg
file in your ask-sdk directory with the following content:[install]
prefix=
Navigate to the skill_env folder and run the pip install command:
$ cd skill_env
$ pip install ask-sdk -t .
More on this can be checked on the homebrew docs.
Next Steps
Now that you've added the SDK to your project, you're ready to begin developing your skill. Proceed to the next section Developing Your First Skill, for instructions on getting started with a basic skill.
Last updated: Feb 06, 2024