Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6403 Discussions

ModuleNotFoundError: No module named 'openvino' in Docker

andife
Novice
882 Views

Hello,

I want to use docker for non-interactive analysis of openvino use cases (speed, preprocessing, different input formats...)

 

Therefore I created a dockerfile with the following content (I know I tried different variants..) 

FROM openvino/ubuntu18_dev:latest

ENV PYTHON_PATH /opt/intel/openvino/python/python3.6:/opt/intel/openvino/python/python3:/opt/intel/openvino/deployment_tools/tools/post_training_optimization_toolkit:/opt/intel/openvino/deployment_tools/open_model_zoo/tools/accuracy_checker:/opt/intel/openvino/deployment_tools/model_optimizer

RUN apt-get update; apt-get install -f -y ca-certificates
RUN apt install -f -y vim ffmpeg libsm6 libxext6 libgl1-mesa-dev
RUN update-ca-certificates
RUN apt-get update 

USER openvino
RUN source /opt/intel/openvino/bin/setupvars.sh

RUN mkdir ~/env
RUN python3 -m venv ~/env/tensorflow2 --system-site-packages
RUN source ~/env/tensorflow2/bin/activate
RUN source /opt/intel/openvino/bin/setupvars.sh

RUN pip3 install opencv-python --trusted-host="pypi.org"

RUN /bin/bash -c "source /opt/intel/openvino/bin/setupvars.sh"
RUN echo "source /opt/intel/openvino/bin/setupvars.sh" >> /home/openvino/.bashrc

RUN python3 ~/run_inference_latest.py

 

I used the commands

docker build -t ml .
docker run --rm -v /mnt/tf2foropenvino/:/data ml

and got

 

+ python3 /home/openvino/run_inference_latest.py
Traceback (most recent call last):
File "/home/openvino/run_inference_latest.py", line 4, in <module>
import openvino
ModuleNotFoundError: No module named 'openvino'


Accessing the container and executing the command manually works

docker run -it -v /mnt/tf2foropenvino/:/data ml bash
python3 /home/openvino/run_inference_latest.py

 

 

0 Kudos
2 Replies
Zulkifli_Intel
Moderator
833 Views

Hello andife,

 

Greetings to you

 

When running the docker build . -t <image-name> (i.e. docker build . -t openvino-ubuntu) to build Docker image, then you need to run the image interactively with docker run -it <image_name> (i.e. docker run -it openvino-ubuntu).

 

To verify Python is able to import IECore from openvino module, test it with Python interpreter:

python3

>>> from openvino.inference_engine import IECore

 

Please share with us more detail on what you trying to achieve.

 

Sincerely,

Zulkifli 

 

0 Kudos
Zulkifli_Intel
Moderator
746 Views

Hello andife,


Thank you for your question. If you need any additional information from Intel, please submit a new question as this thread is no longer being monitored.


Sincerely,

Zulkifli


0 Kudos
Reply