Setting Up The ASK SDK¶
This guide describes how to install the ASK SDK for Python in preparation for developing an Alexa skill.
The ASK SDK for Python requires Python 2 (>= 2.7) or Python 3 (>= 3.6). 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.6.5
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) using the command line tool
pip. If you are using Python 2
version 2.7.9 or later or Python 3 version 3.4 or later,
pip should be
installed with Python by default.
Many Python developers prefer to work in a virtual environment, which is an isolated Python environment that helps manage project dependencies and package versions. The easiest way to get started is to install the SDK in a virtual environment. See the section Set up the SDK in a virtual environment.
Another option is to install the ASK SDK for Python to a specific folder. This ensures that you have the required dependencies and makes it easy to locate and deploy the required files for your finished skill. See the section Set up the SDK in a specific folder.
The following steps showcase the installation process for the standard SDK
distribution. The standard SDK distribution
ask-sdk is the easiest way to 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 do not need everything in the standard distribution
you can install the core package and expand with individual add-on packages
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
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
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
$ virtualenv skill_env
Next, activate your virtual environment and install the sdk.
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 …
If using Mac OS X and you have Python installed using
Homebrew, the preceding command will not work. A simple
workaround is to add a
setup.cfg file in your ask-sdk directory with
the following content:
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