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.
6257 Discussions

HELP to start OpenVINO, OpenCV, and Movidius NCS on the Raspberry



I read  the post of Adrian Rosebrock  (pyimagesearch)

I launched a file bash from cron  the python code

Its contents is:



source /home/pi/.virtualenvs/openvino/bin/activate

cd /home/pi/openvino-pi-object-detection

python3  --prototxt MobileNetSSD_deploy.prototxt --model MobileNetSSD_deploy.caffemodel

But it doesn't work. Below the log file :

Traceback (most recent call last):

  File "", line 2, in <module>

    from import VideoStream

  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/imutils/", line 8, in <module>

    from .convenience import translate

  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/imutils/", line 6, in <module>

    import cv2

ImportError: cannot open shared object file: No such file or directory


I tried to solve this issue, but to no avail.


Important :

when I launch this directly via terminal command  like this :

pi@raspberrypi:~ $ bash -x ;  the software launches and works perfectly

Could you help me to solve this issue in order to launch the  bash file from cron ?


Thanks in advance.

0 Kudos
3 Replies
New Contributor I

Not 100% sure but when starting programs from cron job no environment is inherited, i.e. scfripts run from cron jobs need to use things like  /bin/date instead of just date as no path is set.

I suspect the that is usually sourced in your .bashrc is not being run via the cron job.

You'll likely need to either create the $PYTHONPATH from within your python code, or launch it from a "wrapper" script that sources it before launching the python3 command when started by cron.



0 Kudos

Thanks Walter,


Could you please give me a specific example because I do not understand your answer very well ?


Tanks in advance



0 Kudos
New Contributor I

Why are you trying to start it from a cron job?



You will need to add 

source /home/pi/inference_engine_vpu_arm/bin/

before the line that starts the actual python3 command.


A lot of stuff goes on behind the scenes when you log in that doesn't happen when a script is run from a cron job.  Your cronjob script needs to do all the required setup on its own to make your program. run.  For example you may also need the absolute path to the python3 executable.

Adrian sees virtual environments as a necessity.  I see it as a needless complication for a Raspberry Pi that is likely going to be doing a single IOT type of task. 

I needed to use a Virtual Environment to get his openvino code running on an Odroid XU-4 because the Ubuntu-Mate18 it uses has Python3.6 so I had to "sideload" python 3.5 and use a Virtual environment to get Raspbian OpenVINO to run there.  Extra work, but necessary in this case.  But I don't create a virtual environment until I encounter a conflict that forces it.




0 Kudos