azure-functions-core-tools: `func host start` failing for python -> azure.functions_worker' has no attribute 'start_async'

Hi,

Today I tried to run azure function in python. I am working on Windows.

  • Python 3.6 32-Bit version
  • azure-functions-core-tools@2.4.317

Created project using: func init pythonProject --worker-runtime python Created python function using: func new --language python --template "HttpTrigger" --name myFunction

All this steps succeed: Next tried to host them using: func host start And when all succeed got message:

Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.

Http Functions:

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

[14.02.2019 19:37:26] Traceback (most recent call last):
[14.02.2019 19:37:26] Traceback (most recent call last):
[14.02.2019 19:37:26]   File "C:\Users\xxxx\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 37, in main
[14.02.2019 19:37:26]   File "C:\Users\xxxx\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 46, in <module>
[14.02.2019 19:37:26]     return aio_compat.run(azure.functions_worker.start_async(
[14.02.2019 19:37:26]     main()
[14.02.2019 19:37:26] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[14.02.2019 19:37:26]   File "C:\Users\xxxx\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py", line 37, in main
[14.02.2019 19:37:26]     return aio_compat.run(azure.functions_worker.start_async(
[14.02.2019 19:37:26] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[14.02.2019 19:37:26] Language Worker Process exited.
[14.02.2019 19:37:26] python exited with code 1
 AttributeError: module 'azure.functions_worker' has no attribute 'start_async'.

Any thoughts?

Installing via chocolatey doesn’t solve the issue. It was suggested somewhere. In the end, it just uses azure-functions-core-tools just path will be different. I installed latest version 2.4.317 but tried also azure-functions-core-tools@2.2.70. The same result.

I also check that the same instructions work for dotent and node and they worked. The bug appears only in python

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

FYI, I discovered that my issue was having a 32-bit version of Python installed rather than the 64-bit. Once 32-bit uninstalled and 64-bit installed, I no longer received any errors.

@wolszakp, do you happen to have an older version of azure-functions-worker installed globally (outside the venv)? You can check with pip freeze outside of venv. If so, would you mind updating and trying it again?

I think the error is because our worker is somehow accessing an older version of azure-functions-worker. This shouldn’t ideally happen. If this solves it, I will investigate why our Python process is accessing modules globally.

@wolszakp, @JK87iab thanks for that! That (from google.protobuf.pyext import _message) error seems to be the real problem.

Looks like this is a reported bug in Python 3.6.0 with protobuf 3.6.1.

From the issues, it seemed like several libraries had similar issues with that version of Python. If you guys wouldn’t mind updating Python to (>=) 3.6.1, that should solve the problem. Let me know if that works out.

fyi, @maiqbal11 and @elprans (in case you guys see similar issues opened in the worker repository).

@ankitkumarr -thanks. There is the error at the end: ImportError: DLL load failed: The specified procedure could not be found.

This is the full output:

(.environment) c:\Users\xxxx\Documents\pyfirst>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import azure.functions_worker
>>> from azure.functions_worker.main import main
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\main.py", line 7, in <module>
    from . import dispatcher
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\dispatcher.py", line 15, in <module>
    from . import bindings
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\bindings\__init__.py", line 2, in <module>
    from .meta import check_input_type_annotation
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\bindings\meta.py", line 8, in <module>
    from .. import protos
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\protos\__init__.py", line 1, in <module>
    from .FunctionRpc_pb2_grpc import (  # NoQA
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\protos\FunctionRpc_pb2_grpc.py", line 4, in <module>
    from azure.functions_worker.protos import FunctionRpc_pb2 as azure_dot_functions__worker_dot_protos_dot_FunctionRpc__pb2
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\azure\functions_worker\protos\FunctionRpc_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "C:\Users\xxxx\Documents\pyfirst\.environment\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.

and azure.functions_worker.__version__

>>> azure.functions_worker.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'azure.functions_worker' has no attribute '__version__'