You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-reference-python.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -635,7 +635,7 @@ CORS is fully supported for Python function apps.
635
635
636
636
Thanks to your valuable feedbacks, we are able to maintain a list of troubleshooting guides for common issues:
637
637
638
-
*[ModuleNotFoundError and ImportError](functions-recover-module-not-found.md)
638
+
*[ModuleNotFoundError and ImportError](recover-module-not-found.md)
639
639
640
640
All known issues and feature requests are tracked using [GitHub issues](https://github.com/Azure/azure-functions-python-worker/issues) list. If you run into a problem and can't find the issue in GitHub, open a new issue and include a detailed description of the problem.
Copy file name to clipboardExpand all lines: articles/azure-functions/recover-module-not-found.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,8 @@ This article helps you troubleshoot module-related errors in your Python functio
16
16
17
17
This error issue occurs when a Python function app fails to load a Python module. The root cause for this error is one of the following issues:
18
18
19
-
-[The package can't be found](#the-package-cannot-be-found)
20
-
-[The package isn't resolved with proper Linux wheel](#the-package-is-not-resolved-with-proper-linux-wheel)
19
+
-[The package can't be found](#the-package-cant-be-found)
20
+
-[The package isn't resolved with proper Linux wheel](#the-package-isnt-resolved-with-proper-linux-wheel)
21
21
-[The package is incompatible with the Python interpreter version](#the-package-is-incompatible-with-the-python-interpreter-version)
22
22
-[The package conflicts with other packages](#the-package-conflicts-with-other-packages)
23
23
-[The package only supports Windows or macOS platforms](#the-package-only-supports-windows-or-macos-platforms)
@@ -33,9 +33,9 @@ To identify the actual cause of your issue, you need to get the Python project f
33
33
34
34
The rest of this article helps you troubleshoot potential causes of this error by inspecting your function app's content, identifying the root cause, and resolving the specific issue.
35
35
36
-
## Diagnose ModuleNotFoundError
36
+
## Diagnose ModuleNotFoundError
37
37
38
-
This section details potential root causes of module-related errors. After you figure out which is the likely root cause, you can go to the related mitigation.
38
+
This section details potential root causes of module-related errors. After you figure out which is the likely root cause, you can go to the related mitigation.
39
39
40
40
### The package can't be found
41
41
@@ -57,13 +57,13 @@ See [Enable Remote Build](#enable-remote-build) or [Build Native Dependencies](#
57
57
58
58
Go to `.python_packages/lib/python3.6/site-packages/<package-name>-<version>-dist-info` or `.python_packages/lib/site-packages/<package-name>-<version>-dist-info`. Using a text editor, open the METADATA file and check the **Classifiers:** section. If the section doesn't contains `Python :: 3`, `Python :: 3.6`, `Python :: 3.7`, or `Python :: 3.8`, this means the package version is either too old, or most likely, the package is already out of maintenance.
59
59
60
-
You can check the Python version of your function app from the [Azure portal](https://portal.azure.com). Navigate to your function app, choose **Resource explorer**, and select **Go**.
60
+
You can check the Python version of your function app from the [Azure portal](https://portal.azure.com). Navigate to your function app, choose **Resource explorer**, and select **Go**.
61
61
62
62
:::image type="content" source="media/recover-module-not-found/resource-explorer.png" alt-text="Open the Resource Explorer for the function app in the portal":::
63
63
64
64
After the explorer loads, search for **LinuxFxVersion**, which shows the Python version.
65
65
66
-
See [Update Package To The Latest Version](#update-package-to-the-latest-version) or [Replace Package With Equivalents](#replace-package-with-equivalents) for mitigation.
66
+
See [Update Your Package To The Latest Version](#update-your-package-to-the-latest-version) or [Replace the package with equivalents](#replace-the-package-with-equivalents) for mitigation.
67
67
68
68
### The package conflicts with other packages
69
69
@@ -73,30 +73,30 @@ If you have verified that the package is resolved correctly with the proper Linu
73
73
If you installed azure-storage, or if you installed azure 1.x/2.x and didn’t uninstall azure-storage,
74
74
you must uninstall azure-storage first.</pre>
75
75
76
-
You can find the documentation for your package version in `https://pypi.org/project/<package-name>/<package-version>`.
76
+
You can find the documentation for your package version in `https://pypi.org/project/<package-name>/<package-version>`.
77
77
78
-
See [Update Package To The Latest Version](#update-package-to-the-latest-version) or [Replace Package With Equivalents](#replace-package-with-equivalents) for mitigation.
78
+
See [Update Your Package To The Latest Version](#update-your-package-to-the-latest-version) or [Replace the package with equivalents](#replace-the-package-with-equivalents) for mitigation.
79
79
80
80
### The package only supports Windows or macOS platforms
81
81
82
82
Open the `requirements.txt` with a text editor and check the package in `https://pypi.org/project/<package-name>`. Some packages only run on Windows or macOS platforms. For example, pywin32 only runs on Windows.
83
83
84
84
The `Module Not Found` error may not occur when you're using Windows or macOS for local development. However, the package fails to import on Azure Functions, which uses Linux at runtime. This is likely to be caused by using `pip freeze` to export virtual environment into requirements.txt from your Windows or macOS machine during project initialization.
85
85
86
-
See [Replace Package With Equivalents](#replace-package-with-equivalents) or [Handcraft Requirements.txt](#handcraft-requirementstxt) for mitigation.
86
+
See [Replace the package with equivalents](#replace-the-package-with-equivalents) or [Handcraft Requirements.txt](#handcraft-requirementstxt) for mitigation.
87
87
88
88
## Mitigate ModuleNotFoundError
89
89
90
-
The following are potential mitigations for module-related issues. Use the [diagnoses above](#diagnose-the-root-cause) to determine which of these mitigations to try.
90
+
The following are potential mitigations for module-related issues. Use the [diagnoses above](#diagnose-modulenotfounderror) to determine which of these mitigations to try.
91
91
92
92
### Enable remote build
93
93
94
94
Make sure that remote build is enabled. The way that you do this depends on your deployment method.
95
95
96
-
# [Visual Studio Code](#tab/vscode)
96
+
# [Visual Studio Code](#tab/vscode)
97
97
Make sure that the latest version of the [Azure Functions extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) is installed. Verify that `.vscode/settings.json` exists and it contains the setting `"azureFunctions.scmDoBuildDuringDeployment": true`. If not, please create this file with the `azureFunctions.scmDoBuildDuringDeployment` setting enabled and redeploy the project.
98
98
99
-
# [Azure Functions Core Tools](#tab/coretools)
99
+
# [Azure Functions Core Tools](#tab/coretools)
100
100
101
101
Make sure that the latest version of [Azure Functions Core Tools](https://github.com/Azure/azure-functions-core-tools/releases) is installed. Go to your local function project folder, and use `func azure functionapp publish <app-name>` for deployment.
102
102
@@ -118,7 +118,7 @@ If these are correct, you can update the package to the latest version by changi
118
118
119
119
### Handcraft requirements.txt
120
120
121
-
Some developers use `pip freeze > requirements.txt` to generate the list of Python packages for their developing environments. Although this convenience should work in most cases, there can be issues in cross-platform deployment scenarios, such as developing functions locally on Windows or macOS, but publishing to a function app, which runs on Linux. In this scenario, `pip freeze` can introduce unexpected operating system-specific dependencies or dependencies for your local development environment. These dependencies can break the Python function app when running on Linux.
121
+
Some developers use `pip freeze > requirements.txt` to generate the list of Python packages for their developing environments. Although this convenience should work in most cases, there can be issues in cross-platform deployment scenarios, such as developing functions locally on Windows or macOS, but publishing to a function app, which runs on Linux. In this scenario, `pip freeze` can introduce unexpected operating system-specific dependencies or dependencies for your local development environment. These dependencies can break the Python function app when running on Linux.
122
122
123
123
The best practice is to check the import statement from each .py file in your project source code and only check-in those modules in requirements.txt file. This guarantees the resolution of packages can be handled properly on different operating systems.
0 commit comments