TorchServe AWS EC2 Deployment Error

Hello, I’m getting the following error message:
start java frontend failed: (<class ‘NotADirectoryError’>, NotADirectoryError(20, ‘Not a directory’), <traceback object at 0x7f972aa7ad20>), while trying to start the torchserve serve on AWS EC2, using the following command:

torchserve --start --model-store model_store --models densenet161=densenet161.mar

What am I doing wrong?

1 Like

Based on the error message a directory doesn’t exist. I guess model_store might be the one, so make sure you’ve created it before executing torchserve.

Thanks for the respones.
These are the steps I used.

Step 1
mkdir torchserve-examples
cd torchserve-examples
git clone

Step 2

Step 3
*torch-model-archiver --model-name densenet161 *
*–version 1.0 --model-file serve/examples/image_classifier/densenet_161/ *
*–serialized-file densenet161-8d451a50.pth *
*–extra-files serve/examples/image_classifier/index_to_name.json *
–handler image_classifier

Step 4
mkdir model_store
mv densenet161.mar model_store/
torchserve --start --model-store model_store --models densenet161=densenet161.mar

Step 1 to 3 executed well. Just the last command in step 4 gives me issues.

This is first time I’m using AWS for a project like this. I really don’t know what I’m wrong.
What should I do please.

1 Like

Hi, I am facing a similar problem. The model_store directory is created but I get:
start java frontend failed: (<class 'NotADirectoryError'>, NotADirectoryError(20, 'Not a directory'), <traceback object at 0x7feaf4cafb40>)

The NotADirectoryError suggests that the used path isn’t pointing to a valid directory, so you could check it first via e.g. os.path.isdir(PATH).