azure-functions-python-worker: Failed to start language worker for: python.

I followed the steps in AzureFunctions to create a Python Function but when I tried to run it with func start I got:

func host start

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Azure Functions Core Tools (2.1.748 Commit hash: 5db20665cf0c11bedaffc96d81c9baef7456acb3)
Function Runtime Version: 2.0.12134.0
[29/10/2018 15:09:16] Building host: startup suppressed:False, configuration suppressed: False
[29/10/2018 15:09:17] Reading host configuration file 'C:\path_to_folder\Deployer\host.json'
[29/10/2018 15:09:17] Host configuration file read:
[29/10/2018 15:09:17] {
[29/10/2018 15:09:17]   "version": "2.0"
[29/10/2018 15:09:17] }
[29/10/2018 15:09:17] Initializing Host.
[29/10/2018 15:09:17] Host initialization: ConsecutiveErrors=0, StartupCount=1
[29/10/2018 15:09:17] Starting JobHost
[29/10/2018 15:09:17] Starting Host (HostId=ar2301649w1-60652735, InstanceId=b4c81e61-f576-4449-a431-1487e1f41694, Version=2.0.12134.0, ProcessId=10000, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
[29/10/2018 15:09:17] Loading functions metadata
[29/10/2018 15:09:17] 1 functions loaded
[29/10/2018 15:09:17] Starting language worker process:python  "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py" --host 127.0.0.1 --port 50346 --workerId e4a7da1b-b54c-4536-bbfc-333ff416d8a2 --requestId 4205ee23-e11d-409c-a957-6269517084df --grpcMaxMessageLength 134217728
[29/10/2018 15:09:17] python process with Id=19760 started
[29/10/2018 15:09:17] Generating 1 job function(s)
[29/10/2018 15:09:17] Found the following functions:
[29/10/2018 15:09:17] Host.Functions.ARM
[29/10/2018 15:09:17]
[29/10/2018 15:09:17] Host initialized (359ms)
[29/10/2018 15:09:17] Host started (369ms)
[29/10/2018 15:09:17] Job host started
Hosting environment: Production
Content root path: C:\path_to_folder\Deployer
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...

Http Functions:

        ARM: [GET,POST] http://localhost:7071/api/ARM

[29/10/2018 15:09:22] Host lock lease acquired by instance ID '0000000000000000000000001960BDE6'.
[29/10/2018 15:09:23] Traceback (most recent call last):
[29/10/2018 15:09:23]   File "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 29, in main
[29/10/2018 15:09:23] Traceback (most recent call last):
[29/10/2018 15:09:23]     args.grpc_max_msg_len)
[29/10/2018 15:09:23]   File "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 36, in <module>
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 16, in start
[29/10/2018 15:09:23]     main()
[29/10/2018 15:09:23]     host, port, worker_id, request_id, grpc_max_msg_len))
[29/10/2018 15:09:23]   File "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 29, in main
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\aio_compat.py", line 49, in run
[29/10/2018 15:09:23]     args.grpc_max_msg_len)
[29/10/2018 15:09:23]     return loop.run_until_complete(main)
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 16, in start
[29/10/2018 15:09:23]   File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\asyncio\base_events.py", line 468, in run_until_complete
[29/10/2018 15:09:23]     host, port, worker_id, request_id, grpc_max_msg_len))
[29/10/2018 15:09:23]     return future.result()
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\aio_compat.py", line 49, in run
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 8, in start_async
[29/10/2018 15:09:23]     return loop.run_until_complete(main)
[29/10/2018 15:09:23]     connect_timeout=5.0, max_msg_len=grpc_max_msg_len)
[29/10/2018 15:09:23]   File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\asyncio\base_events.py", line 468, in run_until_complete
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 74, in connect
[29/10/2018 15:09:23]     return future.result()
[29/10/2018 15:09:23]     await disp._grpc_connected_fut
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 8, in start_async
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 337, in __poll_grpc
[29/10/2018 15:09:23]     connect_timeout=5.0, max_msg_len=grpc_max_msg_len)
[29/10/2018 15:09:23]     timeout=self._grpc_connect_timeout)
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 74, in connect
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\grpc\_utilities.py", line 134, in result
[29/10/2018 15:09:23]     await disp._grpc_connected_fut
[29/10/2018 15:09:23]     self._block(timeout)
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 337, in __poll_grpc
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\grpc\_utilities.py", line 84, in _block
[29/10/2018 15:09:23]     timeout=self._grpc_connect_timeout)
[29/10/2018 15:09:23]     raise grpc.FutureTimeoutError()
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\grpc\_utilities.py", line 134, in result
[29/10/2018 15:09:23] Language Worker Process exited.
[29/10/2018 15:09:23]     self._block(timeout)
[29/10/2018 15:09:23] python exited with code 1
 .
[29/10/2018 15:09:23]   File "C:\path_to_folder\env\lib\site-packages\grpc\_utilities.py", line 84, in _block
[29/10/2018 15:09:23] grpc.FutureTimeoutError
[29/10/2018 15:09:23]     raise grpc.FutureTimeoutError()
[29/10/2018 15:09:23] grpc.FutureTimeoutError
[29/10/2018 15:09:23] Starting language worker process:python  "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py" --host 127.0.0.1 --port 50346 --workerId 6464dbe9-3adb-4651-8ac3-09be99767c45 --requestId a233668f-18f0-4934-83b3-767c77c1eb4d --grpcMaxMessageLength 134217728
[29/10/2018 15:09:23] python process with Id=19488 started
[29/10/2018 15:09:29] Traceback (most recent call last):
[29/10/2018 15:09:29]   File "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 29, in main
[29/10/2018 15:09:29]     args.grpc_max_msg_len)
[29/10/2018 15:09:29] Traceback (most recent call last):
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 16, in start
[29/10/2018 15:09:29]   File "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 36, in <module>[29/10/2018 15:09:29]     host, port, worker_id, request_id, grpc_max_msg_len))

[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\aio_compat.py", line 49, in run
[29/10/2018 15:09:29]     main()
[29/10/2018 15:09:29]     return loop.run_until_complete(main)
[29/10/2018 15:09:29]   File "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 29, in main
[29/10/2018 15:09:29]   File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\asyncio\base_events.py", line 468, in run_until_complete
[29/10/2018 15:09:29]     args.grpc_max_msg_len)
[29/10/2018 15:09:29]     return future.result()
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 16, in start
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 8, in start_async
[29/10/2018 15:09:29]     host, port, worker_id, request_id, grpc_max_msg_len))
[29/10/2018 15:09:29]     connect_timeout=5.0, max_msg_len=grpc_max_msg_len)
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\aio_compat.py", line 49, in run
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 74, in connect
[29/10/2018 15:09:29]     return loop.run_until_complete(main)
[29/10/2018 15:09:29]     await disp._grpc_connected_fut
[29/10/2018 15:09:29]   File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\asyncio\base_events.py", line 468, in run_until_complete
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 337, in __poll_grpc
[29/10/2018 15:09:29]     return future.result()
[29/10/2018 15:09:29]     timeout=self._grpc_connect_timeout)
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\__init__.py", line 8, in start_async
[29/10/2018 15:09:29]     connect_timeout=5.0, max_msg_len=grpc_max_msg_len)
**[29/10/2018 15:09:29] Language Worker Process exited.**
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\azure\functions_worker\dispatcher.py", line 74, in connect
**[29/10/2018 15:09:29] python exited with code 1**
 .
[29/10/2018 15:09:29]     await disp._grpc_connected_fut
[29/10/2018 15:09:29]   File "C:\path_to_folder\env\lib\site-packages\grpc\_utilities.py", line 134, in result
[29/10/2018 15:09:29] Starting language worker process:python  "C:\Users\ff824bv\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py" --host 127.0.0.1 --port 50346 --workerId 2a2fb8fd-91d4-4f1d-910f-654aa1a980ac --requestId 146c3297-4087-4bd1-b63f-c479aa2f1be9 --grpcMaxMessageLength 134217728
[29/10/2018 15:09:29] python process with Id=8496 started

Investigative information

Please provide the following:

  • 29/10/2018 15:09:29
  • Function App name Deployer
  • Function name(s) (as appropriate): ARM

Repro steps

Provide the steps required to reproduce the problem:

  1. Follow the steps in AzureFunctions under Windows
  2. Run the function with func host start / func start

Expected behavior

Provide a description of the expected behavior.

  • The Endpoint should start working and processing requests

Actual behavior

Provide a description of the actual behavior observed.

  • The error mentioned in the description
  • When trying to make a request I get this:
Executed 'Functions.ARM' (Failed, Id=f5dbce67-f3a9-4ca6-b558-8eddcfd83a6d)
[29/10/2018 15:14:15] System.Private.CoreLib: Exception while executing function: Functions.ARM. System.Private.CoreLib: Failed to start language worker for: python. One or more errors occurred. (python exited with code 1
 ) (python exited with code 1
 ) (python exited with code 1
 ). python exited with code 1
 .
[29/10/2018 15:14:15] Executed HTTP request: {
[29/10/2018 15:14:15]   "requestId": "74d31ed0-a540-4970-bf32-1a3b73c23814",
[29/10/2018 15:14:15]   "method": "POST",
[29/10/2018 15:14:15]   "uri": "/api/ARM",
[29/10/2018 15:14:15]   "identities": [
[29/10/2018 15:14:15]     {
[29/10/2018 15:14:15]       "type": "WebJobsAuthLevel",
[29/10/2018 15:14:15]       "level": "Admin"
[29/10/2018 15:14:15]     }
[29/10/2018 15:14:15]   ],
[29/10/2018 15:14:15]   "status": 500,
[29/10/2018 15:14:15]   "duration": 1104
[29/10/2018 15:14:15] }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (6 by maintainers)

Commits related to this issue

Most upvoted comments

For those who find this via Google and working on Windows, as mentioned above, the fix is simply to set the environmental variable NO_PROXY=localhost,127.0.0.1. The error probably occurs because you are working behind a corporate proxy and have the variables HTTP_PROXY and HTTPS_PROXY set, but not NO_PROXY. This is an issue with gRPC, see https://github.com/grpc/grpc/issues/9989.

I’ve had a similar issue on linux, which was caused by a corporate proxy. I needed to set no_proxy environment variable for localhost/127.0.0.1

It’s hard to say exactly as each person’s development environment may have slight variations that can cause issues. I see that you’re using Python installed through Visual Studio. You could try re-installing and using Python 3.6 from here: https://www.python.org/downloads/release/python-367/. I’ve encountered some issues (not necessarily Functions related) when trying to use the Python that Visual Studio provides. Feel free to post about any new/same errors you get when you make the switch and we can dig some more.