Skip to content

requirements.txt in dependencies does not work in TFS container #1071

@harusametime

Description

@harusametime

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): TensorFlow serving container
  • Framework Version:1.12-1.14
  • Python Version: 3.6
  • CPU or GPU: both
  • Python SDK Version: 1.42.1
  • Are you using a custom image: No

Describe the problem

Following pre/post-processing section, I want to install pillow for image pre-processing with requirements.txt, and wrote the following code (deploy.py) as explained.

# deploy.py
model = Model(entry_point='inference.py',
              dependencies=['requirements.txt'],
              model_data='s3://mybucket/model.tar.gz',
              role='MySageMakerRole')

deploy.py, inference.py, and requirements.txt are in the same directory.
However no packages are installed. For further investigation, I put the following code at the top of inference.py.

import os
print(os.listdir('/opt/ml/model/code'))
print(os.listdir('/opt/ml/model/code/lib'))

Those returned:

['inference.py', 'lib']
['requirements.txt']

I guess requirements.txt is copied to /opt/ml/model/code/lib and is not used for installing the package; in my opinion, requirements.txt should be in /opt/ml/model/code/.
Please let me know if I missed something.

Minimal repro / logs

Please provide any logs and a bare minimum reproducible test case, as this will be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

  • Exact command to reproduce: (same as above)
model = Model(entry_point='inference.py',
              dependencies=['requirements.txt'],
              model_data='s3://mybucket/model.tar.gz',
              role='MySageMakerRole')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions