Project- How to build low-latency deep-learning-based flask app

13 / 17

Installing the Necessary Packages for model sever and Creating requirements.txt

Let us now install the necessary packages for our model server and create requirements.txt.

  • We would use pip to install the packages. pip is a package-management system used to install and manage software packages.

  • A requirements.txt file is where we mention the details of all the packages - along with their corresponding versions - which are used to create the project.


  • We could create file requirements.txt with the list of all the packages - along with their corresponding versions - which are used in the project using the following command:

    pip freeze > requirements.txt
  • Once we have requirements.txt file, we could use it in the future to install all the packages listed in that file by using the command:

    pip install -r requirements.txt

    Creating requuirements.txt file is very important in every real-case scenario because this helps us have a record of all the packages and their versions used for any software developed.


Note: The following steps might take a bit of time. These packages are said to be successfully installed if the console displays any message like Successfully installed ... after each package installation.

  • Make sure to be inside the Model-Server-Folder which is inside Flask-ZMQ-App-Folder. We could switch to Model-Server-Folder using

    cd ~/Flask-ZMQ-App-Folder/Model-Server-Folder
  • Make sure to activate the virtual environment model-env. We could activate it using

    source model-env/bin/activate
  • Let us just have a look at the modules installed, if any, in our virtual environment model-env that we just created.

    pip freeze

    We could see there are no modules as of now, since this is a new virtual environment that is created just now, and we haven't yet installed any modules till now. We shall now proceed to install the necessary packages for our model server.

  • Install ZMQ package of version 0.0.0 as follows:

    pip install zmq==0.0.0
  • Install the tensorflow package of version 1.14.0 as follows.

    python -m pip install --upgrade setuptools
    pip install --no-cache-dir  --force-reinstall -Iv grpcio==1.11.0
    pip install tensorflow==1.14.0
  • Install protobuf version 3.17.3

    pip install protobuf==3.17.3
  • Install the pillow package of version 6.2.2 as follows, for working with images(like loading the images which we would see later).

    pip install pillow==6.2.2
  • Now create the requirements.txt file as follows:

    pip freeze > requirements.txt
  • If we do ls in the console, we could see model-env and requirements.txt inside the Model-Server-Folder.

  • If you are facing any issues related to the disk quota, please follow the instructions mentioned here.

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...