Modul nicht "azure-data" bei der Bereitstellung von Azure-Funktionen gefunden, funktioniert lokalPython

Python-Programme
Anonymous
 Modul nicht "azure-data" bei der Bereitstellung von Azure-Funktionen gefunden, funktioniert lokal

Post by Anonymous »

Ich baue eine Python -Funktion. Wenn ich es lokal ausführe, funktioniert alles wie erwartet. Alt = "Aktion auf Github -Aktionen" src = "https://i.static.net/f0doum0v.png"/>
Wenn ich jedoch die Azure -Funktionsprotokolle anschaue, sehe ich, dass die Funktion mit 0 Routes gepackt wurde.

Code: Select all

4/11/2025, 2:42:50.361 PM   Job host started    1
4/11/2025, 2:42:49.565 PM   Initializing Warmup Extension.  1
4/11/2025, 2:42:49.571 PM   Initializing Host. OperationId: '1393eee4-b797-4b1e-ba9f-7863e0b9f902'. 1
4/11/2025, 2:42:49.571 PM   Host initialization: ConsecutiveErrors=0, StartupCount=3, OperationId=1393eee4-b797-4b1e-ba9f-7863e0b9f902  1
4/11/2025, 2:42:49.575 PM   Traceback (most recent call last):  1
4/11/2025, 2:42:49.575 PM   File "/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 44, in call   1
4/11/2025, 2:42:49.575 PM   return func(*args, **kwargs)    1
4/11/2025, 2:42:49.575 PM   ^^^^^^^^^^^^^^^^^^^^^   1
4/11/2025, 2:42:49.575 PM   File "/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/loader.py", line 244, in index_function_app    1
4/11/2025, 2:42:49.575 PM   imported_module = importlib.import_module(module_name)  1
4/11/2025, 2:42:49.575 PM   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    1
4/11/2025, 2:42:49.575 PM   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module  1
4/11/2025, 2:42:49.575 PM   return _bootstrap._gcd_import(name[level:], package, level) 1
4/11/2025, 2:42:49.575 PM   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    1
4/11/2025, 2:42:49.575 PM   File "", line 1204, in _gcd_import 1
4/11/2025, 2:42:49.575 PM   File "", line 1176, in _find_and_load  1
4/11/2025, 2:42:49.575 PM   File "", line 1147, in _find_and_load_unlocked 1
4/11/2025, 2:42:49.575 PM   File "", line 690, in _load_unlocked   1
4/11/2025, 2:42:49.575 PM   File "", line 940, in exec_module 1
4/11/2025, 2:42:49.575 PM   File "", line 241, in _call_with_frames_removed    1
4/11/2025, 2:42:49.575 PM   File "/home/site/wwwroot/function_app.py", line 4, in   1
4/11/2025, 2:42:49.575 PM   from azure.data.tables import TableClient, TableServiceClient   1
4/11/2025, 2:42:49.575 PM   ModuleNotFoundError: No module named 'azure.data'   3
< /code>
Was ist das [url=viewtopic.php?t=20324]Problem[/url] hier? Die Funktion startet, wird jedoch in Zeile 4 der function_app.py gefangen - hier ist die Zeile in Code: < /p>
from azure.data.tables import TableClient, TableServiceClient
< /code>
Schätzen Sie hier alle Erkenntnisse < /p>
PS: Natürlich wird die Abhängigkeit in den Anforderungen aufgelistet.  Für den Fall, dass Sie sich gefragt haben - deshalb wird auch irgendwo anders ausgeführt, aber wenn er bereitgestellt wird.# Docs for the Azure Web Apps Deploy action:

https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure Functions: https://aka.ms/python-webapps-actions

name: Deploy

on:
push:
branches:
- test
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './api' # set this to the path to your web app project, defaults to the repository root
PYTHON_VERSION: '3.11' # set this to the python version to use (supports 3.6, 3.7, 3.8)
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
AZURE_COSMOS_CONNECTION_STRING: ${{ secrets.AZURE_COSMOS_CONNECTION_STRING }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python version
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Copy /shared to /api
run: cp -r ./shared ./api/

- name: Create and start virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Install dependencies (api)
run: pip3 install -r ./api/requirements.txt

# Optional: Add step to run tests here
- name: Test function app
run: python3 ./api/function_app.py
# end of tests

- name: Zip artifact for deployment
run: zip release.zip ./api/* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: python-app
path: |
release.zip
deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: 'my_app'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_XXXXXXXX }}
sku: 'flexconsumption'

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post