Installing Python and the SDK
Python is easy to setup on Windows and comes pre-installed on Mac, Linux, and Bash for Windows. This guide walks you through installation and getting your machine ready for use with Azure.
The Azure SDK for Python includes components that allow you to develop, deploy, and manage Python applications for Azure. Specifically, the Azure SDK for Python includes the following:
Management libraries. These class libraries provide an interface managing Azure resources, such as storage accounts, virtual machines.
Runtime libraries. These class libraries provide an interface for accessing Azure features, such as storage and service bus.
There are several flavors of Python interpreters available - examples include:
- CPython - the standard and most commonly used Python interpreter
- PyPy - fast, compliant alternative implementation to CPython
- IronPython - Python interpreter that runs on .Net/CLR
- Jython - Python interpreter that runs on the Java Virtual Machine
CPython v2.7 or v3.3+ and PyPy 5.4.0 are tested and supported for the Python Azure SDK.
There are several ways to get CPython:
- Directly from www.python.org
- From a reputable distro such as www.continuum.io, www.enthought.com or www.activestate.com
- Build from source!
Unless you have a specific need, we recommend the first two options.
If you already have Python installed, you can use pip to install a bundle of all the client libraries in your existing Python 2.7 or Python 3.3+ environment. This will download the packages from the Python Package Index (PyPI).
You may need administrator rights:
- Linux and MacOS, use the
sudo pip install azure-mgmt-compute.
- Windows: open your PowerShell/Command prompt as an administrator
You can install individually each library for each Azure service:
$ pip install azure-batch # Install the latest Batch runtime library $ pip install azure-mgmt-scheduler # Install the latest Storage management library
Preview packages can be installed using the
$ pip install --pre azure-mgmt-compute # will install only the latest Compute Management library
You can also install a set of Azure libraries in a single line using the
azure meta-package. Since not all packages in this meta-package are published as stable yet, the
azure meta-package is still in preview. However, the core packages, from code quality/completeness perspectives can be considered "stable" at this time - it will be officially labeled as such in sync with other languages as soon as possible. We are not planning on any further major changes until then.
Since it's a preview release, you need to use the
$ pip install --pre azure
$ pip install azure==2.0.0rc6
The Python Package Index (PyPI) has a rich selection of Python libraries. If you chose to install a Distro, you'll already have most of the interesting bits for various scenarios from web development to Technical Computing.
Python Tools for Visual Studio (PTVS) is a free/OSS plugin from Microsoft, which turns VS into a full-fledged Python IDE:
Using PTVS is optional, but is recommended as it gives you Python and Web Project/Solution support, debugging, profiling, interactive window, Template editing, and Intellisense.
PTVS works with your existing Visual Studio 2013 or 2015 installation. For documentation, downloads and discussions, see Python Tools for Visual Studio.
For Linux or MacOS, main Azure scenarios that are supported:
Consuming Azure Services by using the client libraries for Python
Running your app in a Linux VM
Developing and publishing to Azure Websites using Git
The first scenario enables you to author rich web apps that take advantage of the Azure PaaS capabilities such as blob storage, queue storage, table storage etc. via Pythonic wrappers for the Azure REST APIs. These works identically on Windows, Mac, and Linux. You can also use these client libraries from your local development machine or a Linux VM running on Azure.
For the VM scenario, you simply start a Linux VM of your choice (Ubuntu, CentOS, Suse) and run/manage what you like. As an example, you can run IPython REPL/notebook on your Windows/Mac/Linux machine and point your browser to a Linux or Windows multi-proc VM running the IPython Engine on Azure. See the IPython Notebook on Azure tutorial for more information.
For information on how to setup a Linux VM, please see the Create a Virtual Machine Running Linux tutorial.
Using Git deployment, you can develop a Python web application and publish it to an Azure Website from any operating system. When you push your repository to Azure, it will automatically create a virtual environment and pip install your required packages.
For more information on developing and publishing Azure Websites, see the tutorials for Creating Websites with Django, Creating Websites with Bottle, and Creating Websites with Flask. For more general information on using any WSGI-compliant framework, see Configuring Python with Azure Websites.
- Azure SDK for Python ReadTheDocs
- Azure SDK for Python Github
- Official Azure samples for Python
- Continuum Analytics Python Distribution
- Enthought Python Distribution
- ActiveState Python Distribution
- SciPy - A suite of Scientific Python libraries
- NumPy - A numerics library for Python
- Django Project - A mature web framework/CMS
- IPython - an advanced REPL/Notebook for Python
- IPython Notebook on Azure
- Python Tools for Visual Studio on GitHub
- Python Developer Center