-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] ModuleNotFoundError: No module named 'dotenv' #1487
Comments
Thanks for reporting will check and update. |
@bhagyshricompany Any updates? |
Also having this issue! |
@gavin-aguiar please comment .Thanks |
@emielsteerneman are you still facing this issue?
Here is a sample github workflow file. https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-github-actions?tabs=linux%2Cpython&pivots=method-manual#example-workflow-configuration-file |
I don't know if I'm still facing this issue. For now I switched to Python 3.10 where this issue is not present. The Github workflow might fix the issue. Unfortunately, doing your steps is not possible with |
Investigative information
Please provide the following:
Repro steps
Step 1: Clone this repository, which is a project I have setup to demonstrate this bug. It is a python 3.11 function app in its most basic form, with
dotenv
as requirement.Step 2: Deploy this project to a Python 3.11 function app on Azure.
Expected behavior
The function app should deploy and start without errors. The
/api/hello
endpoint should work.Actual behavior
An error
ModuleError : No module named 'dotenv'
is thrown.Known workarounds
None
Contents of the requirements.txt file:
Provide the requirements.txt file to help us find out module related issues.
Related information
I've ran into this problem a month ago. I have been trying to deploy my actual project for some time now, but I keep running into errors that are not logged anywhere except in screenshot above. Neither the Core Tools, the Github CI/CD Actions, the Logstream, or the App Insights logs (specifically the
traces
) show any error when deploying. I've managed to trace it back to thedotenv
module. Removing thedotenv
module from the project makes it run without problem. Locally , usingfunc start
, everything works as intended. Only when deploying it to Azure does it fail.Project that demonstrates this problem : https://github.com/emielsteerneman/functionapp_test_dotenv
Related Stackoverflow post : https://stackoverflow.com/questions/78381457/where-to-find-azure-functionapp-deploy-errors-for-python-3-11-in-the-azure-porta/78382299
Actual project to deploy : https://github.com/emielsteerneman/TDP/tree/refactor
Possibly related issue : ModuleNotFoundError: No module named '__main__' #1094
Source and stack trace
Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException
Worker failed to index functions
Result: Failure Exception: ModuleNotFoundError: No module named 'dotenv'. 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 348, in _handle__functions_metadata_request fx_metadata_results = self.index_functions(function_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File '/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/dispatcher.py', line 633, in index_functions indexed_functions = loader.index_function_app(function_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File '/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 49, in call raise extend_exception_message(e, message) File '/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 44, in call return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File '/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/loader.py', line 222, in index_function_app imported_module = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File '/usr/local/lib/python3.11/importlib/init.py', line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File '/home/site/wwwroot/function_app.py', line 2, in import dotenv
Error: No module named 'dotenv', Cannot find module.
Error: No module named 'dotenv', 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'] Traceback (most recent call last): File '/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 44, in call return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File '/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/loader.py', line 222, in index_function_app imported_module = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File '/usr/local/lib/python3.11/importlib/init.py', line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File '', line 1204, in _gcd_import File '', line 1176, in _find_and_load File '', line 1147, in _find_and_load_unlocked File '', line 690, in _load_unlocked File '', line 940, in exec_module File '', line 241, in _call_with_frames_removed File '/home/site/wwwroot/function_app.py', line 2, in import dotenv ModuleNotFoundError: No module named 'dotenv'
ERROR: Error: No module named 'dotenv', Cannot find module.
ERROR: Error: No module named 'dotenv', 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']
No job functions found. Try making your job classes and methods
No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
The text was updated successfully, but these errors were encountered: