Unable to import 'azure.functions'

See original GitHub issue

I am trying to make a python HTTPtrigger function using VC. After working through the VC “Azure-create function” workflow I am greeted with an init.py file causing a pylint import error on import azure.functions as func. when i try to Debug the program i got a pop up about the import error. if the extension has updated or i am working from a fresh workspace it will run .env\Scripts\python -m pip install -r requirements.txt first, but still throws the same import error.

background information:

  • I am getting this same error on two windows 10 machines, both running new installs of Visual Studio Code, that just updated to version 1.33.1

  • i have the Azure account (0.8.2),Azure app service (0.13.0), Azure Functions (0.16.0), Azure Repos (1.149.2) and Python (2019.3.6558) extensions installed.

  • with python version 3.6.8 installed

C:\Users\me\Documents\vc_workspace>.env\Scripts\python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

log : (start)

Executing task: .env\Scripts\python -m pip install -r requirements.txt <

You are using pip version 18.1, however version 19.0.3 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.

Terminal will be reused by tasks, press any key to close it.

Executing task: func extensions install <

Microsoft ® Build Engine version 15.9.20+g88f5fadfbe for .NET Core Copyright © Microsoft Corporation. All rights reserved.

Restore completed in 50.46 ms for C:\Users\me\Documents\vc_workspace\test\extensions.csproj. extensions -> C:\Users\me\Documents\vc_workspace\test\bin\extensions.dll

Build succeeded. 0 Warning(s) 0 Error(s)

Time Elapsed 00:00:02.16

Terminal will be reused by tasks, press any key to close it.

Executing task: .env\Scripts\activate ; func host start <

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

Azure Functions Core Tools (2.5.553 Commit hash: b63f2d6f5479718ca276f7b585a8cc6b9bc57c4f)Function Runtime Version: 2.0.12382.0 [4/9/2019 6:00:57 PM] Starting Rpc Initialization Service. [4/9/2019 6:00:57 PM] Initializing RpcServer [4/9/2019 6:00:57 PM] Building host: startup suppressed:False, configuration suppressed: False [4/9/2019 6:00:57 PM] Reading host configuration file ‘C:\Users\me\Documents\vc_workspace\test\host.json’ [4/9/2019 6:00:57 PM] Host configuration file read: [4/9/2019 6:00:57 PM] { [4/9/2019 6:00:57 PM] “version”: “2.0” [4/9/2019 6:00:57 PM] } [4/9/2019 6:00:58 PM] Initializing Host. [4/9/2019 6:00:58 PM] Host initialization: ConsecutiveErrors=0, StartupCount=1 [4/9/2019 6:00:58 PM] LoggerFilterOptions [4/9/2019 6:00:58 PM] { [4/9/2019 6:00:58 PM] “MinLevel”: “None”, [4/9/2019 6:00:58 PM] “Rules”: [ [4/9/2019 6:00:58 PM] { [4/9/2019 6:00:58 PM] “ProviderName”: null, [4/9/2019 6:00:58 PM] “CategoryName”: null, [4/9/2019 6:00:58 PM] “LogLevel”: null, [4/9/2019 6:00:58 PM] “Filter”: “<AddFilter>b__0” [4/9/2019 6:00:58 PM] }, [4/9/2019 6:00:58 PM] { [4/9/2019 6:00:58 PM] “ProviderName”: “Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider”, [4/9/2019 6:00:58 PM] “CategoryName”: null, [4/9/2019 6:00:58 PM] “LogLevel”: “None”, [4/9/2019 6:00:58 PM] “Filter”: null [4/9/2019 6:00:58 PM] }, [4/9/2019 6:00:58 PM] { [4/9/2019 6:00:58 PM] “ProviderName”: “Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider”, [4/9/2019 6:00:58 PM] “CategoryName”: null, [4/9/2019 6:00:58 PM] “LogLevel”: null, [4/9/2019 6:00:58 PM] “Filter”: “<AddFilter>b__0” [4/9/2019 6:00:58 PM] } [4/9/2019 6:00:58 PM] ] [4/9/2019 6:00:58 PM] } [4/9/2019 6:00:58 PM] FunctionResultAggregatorOptions [4/9/2019 6:00:58 PM] { [4/9/2019 6:00:58 PM] “BatchSize”: 1000, [4/9/2019 6:00:58 PM] “FlushTimeout”: “00:00:30”, [4/9/2019 6:00:58 PM] “IsEnabled”: true [4/9/2019 6:00:58 PM] } [4/9/2019 6:00:58 PM] SingletonOptions [4/9/2019 6:00:58 PM] { [4/9/2019 6:00:58 PM] “LockPeriod”: “00:00:15”, [4/9/2019 6:00:58 PM] “ListenerLockPeriod”: “00:00:15”, [4/9/2019 6:00:58 PM] “LockAcquisitionTimeout”: “10675199.02:48:05.4775807”, [4/9/2019 6:00:58 PM] “LockAcquisitionPollingInterval”: “00:00:05”, [4/9/2019 6:00:58 PM] “ListenerLockRecoveryPollingInterval”: “00:01:00” [4/9/2019 6:00:58 PM] } [4/9/2019 6:00:58 PM] Starting JobHost [4/9/2019 6:00:58 PM] Starting Host (HostId=remoteitjh-907638587, InstanceId=60663409-9550-4482-8445-4a3a1fd3a841, Version=2.0.12382.0, ProcessId=12976, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=) [4/9/2019 6:00:58 PM] Loading functions metadata [4/9/2019 6:00:58 PM] 1 functions loaded [4/9/2019 6:00:58 PM] WorkerRuntime: python. Will shutdown other standby channels [4/9/2019 6:00:58 PM] Starting language worker process:python C:\Users\me.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\ptvsd_launcher.py --default --host 127.0.0.1 --port 9091 --wait “C:\Users\me\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py” --host 127.0.0.1 --port 64977 --workerId fe4300e5-6d12-4b96-aa69-7c51296f5285 --requestId a00e0f1e-3e14-4bde-a4ba-b5ab2265a781 --grpcMaxMessageLength 134217728 [4/9/2019 6:00:58 PM] python process with Id=2064 started [4/9/2019 6:00:58 PM] Generating 1 job function(s) [4/9/2019 6:00:58 PM] Found the following functions: [4/9/2019 6:00:58 PM] Host.Functions.a [4/9/2019 6:00:58 PM] [4/9/2019 6:00:58 PM] Host initialized (237ms) [4/9/2019 6:00:58 PM] Host started (246ms) [4/9/2019 6:00:58 PM] Job host started Hosting environment: Production Content root path: C:\Users\me\Documents\vc_workspace\test Now listening on: http://0.0.0.0:7071 Application started. Press Ctrl+C to shut down.

Http Functions:

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

[4/9/2019 6:01:03 PM] Host lock lease acquired by instance ID ‘0000000000000000000000001E8416E6’. [4/9/2019 6:01:38 PM] Language Worker Process exited. [4/9/2019 6:01:38 PM] The operation has timed out. [4/9/2019 6:01:38 PM] Starting language worker process:python C:\Users\me.vscode\extensions\ms-python.python-2019.3.6352\pythonFiles\ptvsd_launcher.py --default --host 127.0.0.1 --port 9091 --wait “C:\Users\me\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py” --host 127.0.0.1 --port 64977 --workerId 20161430-6943-4a1b-a19f-2200bdeb7163 --requestId aca75901-7dba-45bf-b2a3-360e38321db8 --grpcMaxMessageLength 134217728 [4/9/2019 6:01:38 PM] python process with Id=17372 started [4/9/2019 6:01:38 PM] Adding dependency download request to python language worker (end)

thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jayhub42commented, Apr 17, 2019

Thanks for the information. I am still getting the error, but I figured out that If I click “debug away” when using a new session the function will execute. My best guess at this point is that the linter is NOT pointed to the .env and cannot validate that specific package. When I have time, I will test and investigate the linter configuration.

thanks for your help

Jay

0reactions
ejizbacommented, Apr 15, 2019

Ah that error is coming from pylint. I would suggest taking a look at the docs for linting in Visual Studio code: https://code.visualstudio.com/docs/python/linting

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to import 'azure.functions' pylint(import-error) [3,1] and ...
1 Answer 1 · Locate the Python version in the status bar and click on it · Select the Azure workspace where your...
Read more >
Unable to import 'azure.functions' · Issue #1187 - GitHub
1. i have the Azure account (0.8.2),Azure app service (0.13.0), Azure Functions (0.16.0), Azure Repos (1.149.2) and Python (2019.3.6558) ...
Read more >
Troubleshoot Python errors in Azure Functions - Microsoft Learn
Learn how to troubleshoot Python functions. ... However, the package fails to import on Azure Functions, which uses Linux at runtime.
Read more >
Azure function - import module error - Microsoft Q&A
I'm having an error "ERROR: Failed to generate proxies for remote module 'azureAD'. The -OutputModule parameter does not resolve to a path, and ......
Read more >
Import could not be resolved in VS Code - Microsoft Q&A
I am trying to write a code in Azure Functions through VS Code, but in import it says "Import could not be resolved"....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found