What Should I Do If an Error About builtins Missing Is Displayed During TF Serving Compilation?

Symptom

During TF Serving compilation, the builtins dependency module may fail to be queried, as shown in Figure 1.

Figure 1 Error about builtins missing

Solutions

The reason is that the future dependency package is missing. The solution is to install the future dependency package and check the Python direction.

  1. Install the future dependency package.
    pip3.7 install future
  2. Check whether the Python soft link is pointing to Python 3.7.5.
    Python 3.7.5 is required for TF Serving compilation, and TF Serving-related scripts use the Python interpreter keyword Python by default. However, this keyword is different from that used by Python 2.7, to which the Python soft link is pointing by default. Therefore, you need to redirect the Python soft link to point to Python 3.7.5.
    1. Check the Python version to which the Python soft link is pointing.
      python --version

      If the soft link is pointing to Python 3.7.5, go to 3. Otherwise, go to the next step.

    2. Create a Python soft link pointing to Python 3.7.5.
      ln -sf /usr/local/python3.7.5/bin/python3.7  /usr/bin/python
  3. Recompile TF Serving.
  4. (Optional) Restore the Python soft link.
    ln -sf /usr/bin/python2 /usr/bin/python