I am trying to deploy my script to Azure Function App. Whenever I try to trigger a function I get the error instead:
Result: Failure Exception: ModuleNotFoundError: No module named 'snowflake'.
Cannot find module.
Please check the requirements.txt file for the missing module.
For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound.
Current sys.path: ['/tmp/functions\standby\wwwroot', '/home/site/wwwroot/.python_packages/lib/site-packages',
'/azure-functions-host/workers/python/3.11/LINUX/X64', '/usr/local/lib/python311.zip', '/usr/local/lib/python3.11',
'/usr/local/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/site-packages']
Stack: File "/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/dispatcher.py", line 479,
in _handle__function_load_request func = loader.load_function
My CI/CD is packaging the script in a zip file and deploying to Azure from Bitbucket:
image: atlassian/default-image:3
pipelines:
custom:
deploy-manual:
- step:
name: 'Package into Zip'
script:
- echo 'Zipping the file'
- cd ./AzureFunctions
- zip -r ../func.zip .
- cd ..
artifacts:
- func.zip
- step:
name: 'Deployment to Azure'
script:
- pipe: microsoft/azure-functions-deploy:1.0.2
variables:
AZURE_APP_ID: $
AZURE_PASSWORD: $
AZURE_TENANT_ID: $
FUNCTION_APP_NAME: $
ZIP_FILE: 'func.zip'
I do not have a file named snowflake.py or other naming conflicts.
My requirements.txt is pretty short:
azure-functions
azure-storage-blob
pandas
snowflake-connector-python
azure-identity
azure-keyvault-secrets
Function App is running functions from that file that is stored in blob storage.
I tried changing CI/CD pipeline to install requirements.txt
The zip file contained
.venv/lib/python3.8/site-packages/snowflake/
.venv/lib/python3.8/site-packages/snowflake_connector_python-3.11.0.dist-info/
.venv/lib64/python3.8/site-packages/snowflake/
.venv/lib64/python3.8/site-packages/snowflake_connector_python-3.11.0.dist-info/
and the function was still producing the same error.
I tried changing import snowflake.connector
to from snowflake import connector
and update the code.
Function App is running Python 3.11 I tried switching to Python 3.9, restarting and redeploying the script but it didn’t seem to work.
I can’t find Function App deployment logs to see what goes wrong.
I can’t find Kudu console.
Shiny Loot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.