-2

I am struggling to deploy a Python WorkerRole on Microsoft Azure. Has anybody successfully gotten a Python process working on Microsoft Azure?

Microsoft seems to be telling people that their documentation related to Python on Azure is out of date, see https://azure.microsoft.com/en-us/documentation/articles/cloud-services-python-ptvs/#comment-2790110068 and https://github.com/Microsoft/PTVS/issues/1447.

A Microsoft employ told me that I need to install my own Python interpreter when I deploy a WorkerRole. Does anybody know how to do that?

My worker.py file consists solely of $print("in the worker".format(datetime.now()))

after I deploy the WorkerRole the following error is in both the ConfigureCloudService.err and LaunchWorker.err.

gi : Cannot find path 'E:\approot\%INTERPRETERPATH%' because it does not     exist.
At E:\approot\bin\ConfigureCloudService.ps1:189 char:15
+ Set-Alias py (gi $interpreter_path -EA Stop)
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (E:\approot\%INTERPRETERPATH%:String) [Get-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand
andrewkittredge
  • 742
  • 5
  • 12
  • Your link is to something related to worker roles, nothing to do with Web Jobs. No clue who you're referencing (@zooba) and why anyone would be suggesting deploying a python interpreter (since that is *not* required). Meanwhile... you've shown nothing about what you've tried - you simply posted a question asking if anyone has gotten a python web job working. As it stands, this question will likely be closed. – David Makogon Jul 21 '16 at 16:43
  • Yeah, I got WebJob and WorkerRole confused. I am trying to deploy a WorkerRole. – andrewkittredge Jul 21 '16 at 17:20
  • @DavidMakogon, I modified my question. Is that information helpful? – andrewkittredge Jul 21 '16 at 17:41

1 Answers1

0

@andrewkittredge, I don't think you need to install Python environment manually before deploying a WorkerRole or a WebJob, because the Python runtime has been installed on Azure, just need to be specified or set up in the related configuration.

According to the article, you need to create a workrole via VS with PTVS. Then, Install Python on the cloud service means you need to set the Python variable to on on the startup tasks in the ServiceDefinition.csdef file as below.

<Variable name="PYTHON2" value="on" />

Please see the article Common Cloud Service startup tasks to know the startup tasks for Cloud Services.

Compared with WorkerRole, I think WebJobs is easier to use and deploy, please see the articles Run Background tasks with WebJobs and Deploy WebJobs using Visual Studio.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • According to the updated documentation @ https://azure.microsoft.com/en-us/documentation/articles/cloud-services-python-ptvs/ you do need to install Python. I eventually got my worker role going with that updated documentation. In theory WebJobs look like a good solution. But I ran into two problems. I couldn't get the WebJob Python to run in 64 bit mode I tried changing the application platform setting to 64 bit but the WebJob interpreter was still in 32 bit mode. Also I couldn't get Numpy working in a WebJob. I tried using a wheel but I ran into the upload size limit on WebJobs. – andrewkittredge Jul 27 '16 at 21:42