Configuring Deployment

While the included PowerShell scripts may be edited freely, it is possible to set most configuration options through your Python project.

To specify the version of Python your worker should run with, make it the active environment for your project. (Ensure that you have a WebPI reference or startup task to install this version on the instance - see the documentation in ConfigureCloudService.ps1 for more details.)

If your version of Python cannot be detected using the CPython registry keys after it has been installed, you can add the DeployedPythonInterpreterPath property to your Python project by editing the .pyproj file. This path will take precedence over the active environment.

To install packages using pip, update the requirements.txt file in the root directory of your project.

To set PYTHONPATH (or equivalent) before running the worker, add the necessary Search Paths to your project.

To specify the script to run, make it the startup file in your project.

To specify command-line arguments, add them to the Command Line Arguments property under Project Properties\Debug.

Troubleshooting Deployment

If your worker role does not behave correctly after deployment, check the following:

  1. Your Python project includes a bin\ folder with (at least):

  2. Your Cloud project references those files from the service definition.
  3. Your Python project includes either:
  4. Enable Remote Desktop on your Cloud Service and investigate the log files.

    Logs for ConfigureCloudService.ps1 and LaunchWorker.ps1 are stored in the following path on the machine instance:

    Currently, the LaunchWorker.ps1 log is the only way to view output or errors displayed by your Python program.

  5. Start a discussion at our discussion forum for further help.

This readme file may be deleted when you no longer need it.