Help Center/ ModelArts/ Troubleshooting/ Inference Deployment/ Service Deployment/ Failed to Deploy a Service and Error "No Module named XXX" Occurred
Updated on 2023-01-10 GMT+08:00

Failed to Deploy a Service and Error "No Module named XXX" Occurred

Symptom

Deploying a service failed. The system displays error message "No Module named XXX".

Possible Causes

"No Module named XXX" indicates that the dependency module is not imported to the model.

Solution

Import the required dependency module to the model through inference code.

For example, when you attempt to deploy a PyTorch AI application as a real-time service, the system displays error message "ModuleNotFoundError: No module named 'model_service.tfserving_model_service'". In this case, configure "from model_service.pytorch_model_service import PTServingBaseService" in customize_service.py. Example code:

import log
from model_service.pytorch_model_service import PTServingBaseService