Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5560 Discussions

When I import openvino.inference_engine, I faced crash the python in Raspberry Pi4, Ubuntu18.04.

Yusuke0202
Beginner
811 Views

Hello, everyone.

I'm trying to use OpenVINO and NCS2 in my Raspberry Pi4 machine. 

I successfully built the OpenVINO for Python3.7 environment as following:

https://software.intel.com/content/www/us/en/develop/articles/arm64-sbc-and-ncs2.html

https://github.com/openvinotoolkit/openvino/issues/1550

However, when I tried to import openvino.inference in Python, I faced the "Segmentation fault (core dumped)" and crash Python in my console.

Actually, when I import openvino only, I didn't face crash, but the case of "openvino.inference_engine" is crashing my Python ("from openvino import inference_engine" is also crashing).

How can I do that?

-----

My environment as below.

Machine: Raspberry Pi4 8GB

OS: Ubuntu18.04 and Ubuntu Mate

Python: Python3.7.4 (virtualenv)

-----
Thank you in advance.

 

0 Kudos
22 Replies
Yusuke0202
Beginner
711 Views
Rizal_Intel
Moderator
693 Views

Hi Yusuke,

 

There is an OpenVINO distribution for the Raspberry Pi with NCS2 but it is for Raspberry Pi OS.

Is there a need for you to use Ubuntu as the OS?

If not I would recommend you to use Raspberry Pi OS/Raspbian.

 

I have managed to compile and load openvino.inference_engine in python without throwing segmentation fault.

However my environment is a little bit different.

 

I ran it on

Machine: Pi 4 (4GB RAM)

OS : Ubuntu Desktop 20.10 for ARM .

Python : 3.7.9 (I had some trouble using apt-get so I compiled from source. I did NOT run this in virtual env).

 

Regards,

Rizal


Yusuke0202
Beginner
690 Views

Hi Rizal,

Thank you for replying, actually I have the restriction of using Ubuntu 18.04 OS in my project. 


I'm still struggling to build OpenVINO library for python.
I tried to use other branch like 2020.3 and 2020.4, however it give me another error, then I cannot reach to built python library...
I didn't try out of virtualenv, so I will try to build in original environment.

Rizal_Intel
Moderator
682 Views

Hi Yusuke,


Could you help share the website or download link to the exact image of the OS you are using?

The current Ubuntu distribution I found for ARM are mostly Ubuntu version 20.


Regards,

Rizal


Yusuke0202
Beginner
678 Views

Hi Rizal,

Yes, you are right.
Currently only ubuntu20.04 LTS is distributed in https://ubuntu.com/download/raspberry-pi

I installed 18.04LTS in this link previously. Sorry I can't share the answer which you are looking for.

Rizal_Intel
Moderator
640 Views

Hi Yusuke, do you have a copy of the ARM Ubuntu 18.04 image that you could share?


Regards,

Rizal


Yusuke0202
Beginner
623 Views

Hi Rizal, thank you for your support.
I changed plan to use Ubuntu20.04 LTS Server and Ubuntu Mate, however I still got segmentation fault even if I didn't use virtualenv.
Could you check it by using Ubuntu20.04LTS Server?

Yusuke0202
Beginner
621 Views

And also my make option is as following:

----

sudo cmake  -DCMAKE_BUILD_TYPE=Release \

-DENABLE_MKL_DNN=OFF \

-DENABLE_CLDNN=OFF \

-DENABLE_GNA=OFF \

-DENABLE_SSE42=OFF \

-DTHREADING=SEQ \

-DENABLE_OPENCV=OFF \   

-DENABLE_PYTHON=ON \

-DPYTHON_EXECUTABLE=/usr/local/bin/python3.7 \

-DPYTHON_LIBRARY=/usr/local/lib/python3.7/config-3.7m-aarch64-linux-gnu/libpython3.7m.a \

-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.7m \

..

Rizal_Intel
Moderator
609 Views

Hi Yusuke,


Replicating your case may take a longer time.

I would like to confirm you are using the 64bit version of the OS?


Regards,

Rizal


Yusuke0202
Beginner
607 Views

Hi Rizal,

Thank you for supporting.
Yes, I'm using 64bit Ubuntu 18/20 LTS.

Rizal_Intel
Moderator
567 Views

Hi Yusuke,

 

I am able to avoid the segmentation error by using the following arguments when building the Python wrappers for the OpenVINO.

 

-DPYTHON_EXECUTABLE=`which python3.x` \

-DPYTHON_LIBRARY=<path to downloaded python source>/Lib \

-DPYTHON_INCLUDE_DIR=<path to downloaded python source>/Include \

 

I needed to copy pyconfig.h inside the source into the Include folder in order for it to work.

I followed some instruction similar to this guide for compiling Python.

 

I have tested importing and initiating IECore class without error, but have yet to test the full functionality.

Could you try compiling using the arguments mentioned to see if it works on your machine?

 

Regards,

Rizal

 

Yusuke0202
Beginner
545 Views

Hi Rizal,

Thank you for your supporting. I will try it!
By the way, Is your environment Ubuntu20.04Server? and built latest version of OpenVINO?

Thanks,
Yusuke

Rizal_Intel
Moderator
527 Views

Hi Yusuke,


Yes I am using Ubuntu Server20.4 and I cloned OpenVINO from the master branch of the repository. I used Python 3.7.9 but I think you can use any version (not tested) as you will compile the pyd from source.


Additionally, I found where Ubuntu place its downloads for previous version Ubuntu for ARM.

It is in Ports, Unsupported, and Experimental Images for Ubuntu at https://releases.ubuntu.com/.


Regards,

Rizal


Yusuke0202
Beginner
518 Views

Hi Rizal,

Thank you for supporting. I followed your description, however I still got segmentation fault.
Actually, I was able to build OpenVINO (nothing error when cmake/make/make install command).

I used "gdb" command to see error in detail (I've heard gdb help us when we faced segmentation error). Then it shows:

---

ubuntu@ubuntu:~$ gdb python3.7

...

(gdb) r

Starting program: /usr/local/bin/python3.7

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Python 3.7.4 (default, Oct 19 2020, 03:15:56)

[GCC 7.5.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> from openvino.inference_engine import IECore

 

Program received signal SIGSEGV, Segmentation fault.

0x0000fffff74a3714 in ?? ()

   from /usr/local/python/python3.7/openvino/inference_engine/ie_api.so

(gdb) bt

#0  0x0000fffff74a3714 in ?? ()

   from /usr/local/python/python3.7/openvino/inference_engine/ie_api.so

#1  0x0000fffff771b900 in ?? ()

   from /usr/local/python/python3.7/openvino/inference_engine/ie_api.so

Backtrace stopped: previous frame inner to this frame (corrupt stack?)

---

It's not help me...

Rizal_Intel
Moderator
500 Views

Hi Yusuke,


I am sorry but I may be wrong in my compilation method.


I have received a feedback from my colleagues and they concluded that the configuration is not officially supported.


They have tested it from their side and confirmed it is not supported.

I would have to recommend installing Raspbian OS on your Raspberry Pi for OpenVINO usage.


Thankyou for exploring this deployment possibility and

I am sorry it has taken this long.


Is there anything else I can help with?


Regards,

Rizal


Yusuke0202
Beginner
495 Views

Hi Rizal,

No, it's okay. I really appreciate your supporting long time. 

I will discuss with my colleague to find another way.
Actually, there is only Raspbian OS 32bit version, then it cannot use fully 8GB memory model of Raspberry pi. And also there are some problem in ROS usage.
I hope OpenVINO Ubuntu version will be released in future.
Thank you for your kindness and hospitality.

Respectfully,

Yusuke

Yusuke0202
Beginner
489 Views

Hi Rizal,

Sorry, just one question.
Were you able to load openvino.inference_engine by using Ubuntu20.01 and Ubuntu20.04, right?

Respectfully,
Yusuke

Rizal_Intel
Moderator
478 Views

Hi Yuusuke,


Yes, I was able to load the openvino.inference engine on Ubuntu 20.04.

I build in <openvino source>/build/,

then I found the python wrappers in <openvino source>/bin/aarch64/Release/lib/python_api/python3.x/

Then I added that path to the PYTHONPATH.


Regards,

Rizal


Yusuke0202
Beginner
472 Views

Hi Rizal,

I understood.
I'm glad to hear that, I will find good solution in my free time.
Thanks for your support!!

Respectfully,
Yusuke

Rizal_Intel
Moderator
321 Views

Hi Yusuke,


Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question.


On a final note, I compiled it on Pi4 with 4GB RAM (just in case there is a difference between the 4GB and 8GB RAM versions).


I hope you will be able to find a solution to your project needs.

I wish you all the best Yusuke.


Regards,

Rizal


Reply