Reputation: 11
I am using a Dockerfile and requirements.txt in order to setup my azure function app (following this tutorial).
This is my Dockerfile and this is my requirements.txt. After I build the docker image using: sudo docker build --tag measurekid/mkserverless:v1.0.0 .
I run sudo docker run -p 8080:80 -it measurekid/mkserverless:v1.0.0
and I get this error. The project structure is as followes:
|-- project
|-- serverless #(which is the azure function root)
|-- BedPredict
|-- __init__.py and more
|-- bed-coordinates-detection
|-- bed_pipeline.py (which has the function "mask_pipeline")
In my __init__.py
file I have the following lines:
import sys
sys.path.append("../../bed-coordinates-detection/")
from bed_pipeline import mask_pipeline
But as you can see in error message attached above, I get ModuleNotFoundError: No module named 'bed_pipeline'
.
I have tried following this troubleshooting guide but I couldn't reach the project files (None of the methods worked).
I am very new to Azure and Azure function app and I have no idea what went wrong. Any ideas? Any response would be super appreciated.
Thanks!
Upvotes: 0
Views: 157
Reputation: 6508
As per your project structure, you need to go one more level up from __init__.py
to get bed-coordinates-detection
. Also in your project structure, the name is bed-bed-coordinates-detection
(bed twice, is it typo?).
import sys
sys.path.append("../../bed-coordinates-detection/")
from bed_pipeline import mask_pipeline
By the way, the problem has nothing to do with Azure Function or Docker. You can debug in your local without docker-izing which can easily reveal the issue.
Upvotes: 1