Search code examples
python-3.xazure-functionsh2o

Azure Functions with python runtime. H2O Module not available error


I am trying to create an Azure python function which uses H20 module. When I tried to test it locally I am getting module not available error even though I have specified it in requirements.txt and it seem to be installed in the virtual env and I am able to run using virtual environment manually.

Minimal Python code:

import datetime
import logging

import h2o
import azure.functions as func

def main(mytimer: func.TimerRequest) -> None:
    utc_timestamp = datetime.datetime.utcnow().replace(
        tzinfo=datetime.timezone.utc).isoformat()
    if mytimer.past_due:
        logging.info('The timer is past due!')
    logging.info('Python timer trigger function ran at %s', utc_timestamp)

requirement.txt

h2o==3.32.0.2

Error.txt: enter image description here

Python version 3.9m Windows 10 OS.


Solution

    1. Created the Azure Python Timer Trigger Function in VS Code.
    2. Installed the below dependencies in the VS Code Project terminal:
    pip install requests
    pip install tabulate
    pip install future
    
    1. If any existing or previous versions of H2o is available, uninstall it using the below command: enter image description here
    2. Next, run this command to install H2o module in the Project integrated terminal:
    pip install -f http://h2o-release.s3.amazonaws.com/h2o/latest_stable_Py.html h2o
    

    enter image description here

    With the version of h2o==3.32.0.2, I also got the same exceptions in VS Code output terminal. So, I have tried with the below versions and working well.

    requirements.txt file:

    azure-functions
    h2o==3.36.1.2
    

    Result:

    enter image description here

    It also working with the version 3.14.0.2 H2o module in Python.