Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a problem with gen_protos on aarch64 platform. #4489

Closed
Heartful-echo opened this issue May 29, 2023 · 8 comments
Closed

I have a problem with gen_protos on aarch64 platform. #4489

Heartful-echo opened this issue May 29, 2023 · 8 comments
Assignees
Labels
platform:python MediaPipe Python issues type:build/install For Build and Installation issues

Comments

@Heartful-echo
Copy link

OS Platform and Distribution

Ubuntu20.04 LTS

Compiler version

gcc/gcc+8

Programming Language and version

Python3.8

Installed using virtualenv? pip? Conda?(if python)

No response

MediaPipe version

0.10.0

Bazel version

5.1

XCode and Tulsi versions (if iOS)

No response

Android SDK and NDK versions (if android)

No response

Android AAR (if android)

None

OpenCV version (if running on desktop)

No response

Describe the problem

I have successfully built MediaPipe 0.9.3.0 on aarch64 platform, created whl file and run it on Raspberry Pi4.

However, when building with MediaPipe 0.10.0 using the same procedure, the following error is output.

How can i solve this problem?

Complete Logs

root@ubuntu:/mp/mediapipe# python3 setup.py gen_protos
running gen_protos
generating proto file: build/lib.linux-aarch64-3.8/mediapipe/tasks/cc/components/processors/proto/detection_postprocessing_graph_options_pb2.py
mediapipe/tasks/cc/components/processors/proto/detection_postprocessing_graph_options.proto:30:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.
mediapipe/tasks/cc/components/processors/proto/detection_postprocessing_graph_options.proto:34:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.
mediapipe/tasks/cc/components/processors/proto/detection_postprocessing_graph_options.proto:39:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.
mediapipe/tasks/cc/components/processors/proto/detection_postprocessing_graph_options.proto:44:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.
mediapipe/tasks/cc/components/processors/proto/detection_postprocessing_graph_options.proto:47:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.
root@ubuntu:/mp/mediapipe#
@Heartful-echo Heartful-echo added the type:build/install For Build and Installation issues label May 29, 2023
@kuaashish kuaashish assigned kuaashish and unassigned ayushgdev May 30, 2023
@kuaashish kuaashish added the platform:python MediaPipe Python issues label May 30, 2023
@kuaashish
Copy link
Contributor

Hello @Heartful-echo,

Could you please elaborate your query with complete details and steps followed to reproduce the issue from our end.

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label May 30, 2023
@Heartful-echo
Copy link
Author

Heartful-echo commented May 30, 2023

Hi @kuaashish

Thank you for your comment.

My steps are below.
$ git clone -b v0.10.0 https://github.com/google/mediapipe

$ sed -i -e "/"imgcodecs"/d;/"calib3d"/d;/"features2d"/d;/"highgui"/d;/"video"/d;/"videoio"/d" third_party/BUILD
$ sed -i -e "/-ljpeg/d;/-lpng/d;/-ltiff/d;/-lImath/d;/-lIlmImf/d;/-lHalf/d;/-lIex/d;/-lIlmThread/d;/-lrt/d;/-ldc1394/d;/-lavcodec/d;/-lavformat/d;/-lavutil/d;/-lswscale/d;/-lavresample/d" third_party/BUILD

$ sed -i -e "/^ # Optimization flags/i \ "ENABLE_NEON": "OFF"," third_party/BUILD
$ sed -i -e "/^ # Optimization flags/i \ "WITH_TENGINE": "OFF"," third_party/BUILD

$ sudo python3 setup.py gen_protos

Next, I want to run the following command to build, but I get an error with python3 setup.py gen_protos.

$ sudo python3 setup.py bdist_wheel

I see a file called detection_*** added in 0.10.0.
This file has syntax = "proto3"; Until now it was syntax = "proto2";
I'm assuming this has an effect.

I tried changing the syntax="proto3" in the detection_*** files to syntax="proto2" and building.
The whl file is created but when I write the code using this whl file I get the below error.

root@ubuntu:/mp# python3 object.py
Traceback (most recent call last):
File "object.py", line 3, in
import mediapipe as mp
File "/usr/local/lib/python3.8/site-packages/mediapipe/init.py", line 30, in
import mediapipe.tasks.python as tasks
ImportError: cannot import name 'python' from 'mediapipe.tasks.python' (/usr/local/lib/python3.8/site-packages/mediapipe/tasks/python/init.py)

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label May 30, 2023
@kuaashish
Copy link
Contributor

@Heartful-echo

I could not reproduce the issue from our end. Would you please let us know the complete steps followed from the mediapipe documentation or Any link? Which you can point here that will be helpful to reproduce the issue.

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Jun 7, 2023
@Heartful-echo
Copy link
Author

@kuaashish

Can you provide the whl file of mediapipe0.10.0 for aarch64 in python3.8 environment?
My aim is to use mediapipe0.10.0 on Raspberry Pi4 64bit.
Thank you

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Jun 9, 2023
@krebsbstn
Copy link

I am facing the same issue, i am able to provide a Dockerfile trying to build mediapipe from source. This one creates the Proto-Error aswell.

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        gcc-8 g++-8 \
        protobuf-compiler \
        ca-certificates \
        curl \
        wget \
        ffmpeg \
        git \
        unzip \
        nodejs \
        cmake \
        python3-dev \
        python3-opencv \
        python3-pip \
        libopencv-core-dev \
        libopencv-highgui-dev \
        libopencv-imgproc-dev \
        libopencv-video-dev \
        libopencv-calib3d-dev \
        libopencv-features2d-dev \
        software-properties-common && \
    add-apt-repository -y ppa:openjdk-r/ppa && \
    apt-get update && apt-get install -y openjdk-8-jdk && \
    apt-get install -y mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev && \
    apt-get install -y mesa-utils && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-8
RUN pip3 install --upgrade setuptools
RUN pip3 install wheel
RUN pip3 install future
RUN pip3 install absl-py numpy protobuf==3.20.1
RUN pip3 install six==1.14.0

# Install bazel
ARG BAZEL_VERSION=6.1.1
RUN mkdir /bazel && \
    wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\
azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
    wget --no-check-certificate -O  /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \
    chmod +x /bazel/installer.sh && \
    /bazel/installer.sh  && \
    rm -f /bazel/installer.sh

# Clone Mediapipe
RUN git clone https://github.com/google/mediapipe.git
RUN cd mediapipe && \
    sed -i -e "/\"imgcodecs\"/d;/\"calib3d\"/d;/\"features2d\"/d;/\"highgui\"/d;/\"video\"/d;/\"videoio\"/d" third_party/BUILD && \
    sed -i -e "/-ljpeg/d;/-lpng/d;/-ltiff/d;/-lImath/d;/-lIlmImf/d;/-lHalf/d;/-lIex/d;/-lIlmThread/d;/-lrt/d;/-ldc1394/d;/-lavcodec/d;/-lavformat/d;/-lavutil/d;/-lswscale/d;/-lavresample/d" third_party/BUILD && \
    sed -i 's/"WITH_WEBP": "OFF"/"WITH_WEBP": "OFF",\n       "ENABLE_NEON": "OFF",\n         "WITH_TENGINE": "OFF"/' third_party/BUILD

RUN apt-get update && apt-get install -y libprotobuf-dev

#replace __version__ variable in setup.py
RUN sed -i "s|__version__ = 'dev'|__version__ = '0.8'|g" mediapipe/setup.py

RUN cd mediapipe && \
    python3 setup.py gen_protos
RUN cd mediapipe && \
    python3 setup.py bdist_wheel

Be aware that this needs some space and time to be built but it shows how the current Proto-Error is raising.

@kuaashish
Copy link
Contributor

@Heartful-echo,

We do not have official wheels for aarch64 in python now. However, Support of Raspberry Pi is in our roadmap and will be available soon.

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Jun 16, 2023
@Heartful-echo
Copy link
Author

@kuaashish

This is very good information.
I hope one day MediaPipe will be available on Raspberry Pi and CPUs with the same aarch64 architecture.
This case will be closed.

I appreciate your support.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Jun 16, 2023
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:python MediaPipe Python issues type:build/install For Build and Installation issues
Projects
None yet
Development

No branches or pull requests

4 participants