How to load spacy model en_core_web_sm or other models in requiremts.txt for deployment in web app?

Akshata Purshottam Palsule 21 Reputation points
2022-07-20T05:21:44.213+00:00

Hello Community,

I have a small query by default azure has 'pip install' libraries from requiremts.txt but how to load spacy models with same,
So I wanted to load my spacy models to web app and run my python code as web app so how to do it by loading in requiremts.txt

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,972 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-07-21T20:40:21.267+00:00

    @Akshata Purshottam Palsule , You may run an unsupported version of Python by building your own container image instead.

    Just to highlight, Python apps must be deployed with all the required pip modules.

    The App Service deployment engine automatically activates a virtual environment and runs pip install -r requirements.txt for you when you deploy a Git repository, or a zip package with build automation enabled.
    App Service's build system, called Oryx, performs the following steps when you deploy your app if the app setting SCM_DO_BUILD_DURING_DEPLOYMENT is set to 1:

    Kindly try the suggestions/flow outlined in this document:

    Other frameworks and web servers

    • Include the framework and/or web server in your requirements.txt file.
    • In your startup command, identify the WSGI callable as described in the previous section for Flask.
    • To launch a web server other than Gunicorn, use a python -m command instead of invoking the server directly.

    Ref: Container characteristics

    Checkout this similar discussion thread : Azure Python Deployment - Spacy nomodule found exception

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.