Search code examples
azureazure-aksazure-machine-learning-serviceazure-container-instancesazure-ai

Error deploying Azure Machine Learning Studio Designer inference pipeline: "ImportError with werkzeug.urls" in real-time endpoint


I am using one of the pre-built pipelines in Azure Machine Learning Studio designer, specifically the 'Wide & Deep based Recommendation - Restaurant Rating Prediction' pipeline. I have successfully run the pipeline to train the model and create an inference pipeline. However, I encountered an error when attempting to deploy the model to the real-time endpoint. The error message I'm receiving is:

ImportError: cannot import name 'url_quote' from 'werkzeug.urls'

This error occurs when deploying to both AKS (AksCompute) and ACI (Azure Container Instances) compute types.

I suspect that downgrading the version of Werkzeug to 2.2.2 may resolve the issue, but I am unsure how to do this in the Azure Machine Learning Studio environment.

How to resolve this error?


Solution

  • You need to create a custom environment to add extra dependencies and packages, and select that environment while deploying the endpoint.

    Follow the steps below to create a custom environment:

    1. Go to Environments > Custom environments > Create

      enter image description here

    2. Next, give a name to the environment.

      enter image description here

    3. I selected the existing environment for the Select environment source option. If you have a Docker context, you can choose that as well.

    4. Next, I selected model-evaluation for the environment type. You can select according to your requirements.

      enter image description here

    5. Click on next, and you will see the customization options as shown below.

      enter image description here

    6. Here, you will find a conda.yaml or requirements.txt file. Click on it and add your package names.

      enter image description here

    7. After creating the environment, register the model and start deploying it in a real-time endpoint.

      To register, refer to the image below:

      enter image description here

      To deploy:

      enter image description here

    8. While deploying the model, select the created custom environment in the Code + environment tab.

      enter image description here