mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Question regarding Mediapipe hands Api jetson Nano

Open RohitSingh1226 opened this issue 3 years ago • 24 comments

The use of mediapipe in windows was easy andit was installed using pip, after searching a lot I was able to build the examples of mediapipe using bazel build.

After I ssh and open the terminal to import mediapipe it works, but when I run my personal code where I was enhanced mediapipe, it shows no module named mediapipe. I don't have a .BUILD file for my example is that the issue image

RohitSingh1226 avatar May 05 '21 11:05 RohitSingh1226

Hi @RohitSingh1226, Have you followed the instructions to install MediaPipe python?https://google.github.io/mediapipe/getting_started/building_examples.html#python.

sgowroji avatar May 06 '21 03:05 sgowroji

Thanks for the prompt @sgowroji. I did, that’s why I was able to import it on the terminal, the examples have a .BUILD file, my program is a python file and strangely not able to import the package. Does it have something to do with the paths? Because I moved my project folder to the location where I’ve built my mediapipe using bazelisk

RohitSingh1226 avatar May 06 '21 06:05 RohitSingh1226

Can you run $ python3 -c 'import mediapipe as mp; help(mp); print(mp.__file__)' to see that if mediapipe is indeed installed?

jiuqiant avatar May 06 '21 15:05 jiuqiant

@RohitSingh1226 you may also reffer as to a reference to https://github.com/jiuqiant/mediapipe_python_aarch64 or to https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

AndreV84 avatar May 06 '21 16:05 AndreV84

python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'

image

RohitSingh1226 avatar May 06 '21 18:05 RohitSingh1226

@RohitSingh1226 you may also reffer as to a reference to https://github.com/jiuqiant/mediapipe_python_aarch64 or to https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

@AndreV84 thanks for replying immediately, I Have tried to run and build the wheel on python by executing the command python3 setup.py gen_protos, I get the following error. Does this issue have something to do with the shebang inside the setup.py.

image

RohitSingh1226 avatar May 06 '21 18:05 RohitSingh1226

revise steps here https://github.com/jiuqiant/mediapipe_python_aarch64#step-to-build-mediapipe-python-on-aarch64-ubuntu-2004 it shows what to do with protoc err

AndreV84 avatar May 06 '21 18:05 AndreV84

@RohitSingh1226 refrer to this instruction instead if the other two instructions won't work for you https://github.com/google/mediapipe/blob/master/docs/getting_started/python.md#building-mediapipe-python-package

AndreV84 avatar May 06 '21 18:05 AndreV84

ah, I see there is no instruction on how to make dist builds in the latter url, but on how to build for windows

AndreV84 avatar May 06 '21 19:05 AndreV84

@jiuqiant is there instruction on how to build python wheel from sources for arm linux? just linux?

AndreV84 avatar May 06 '21 19:05 AndreV84

in my case the output is

python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'

NAME
    mediapipe

PACKAGE CONTENTS
    mediapipe (package)
    objectron
    setup

FILE
    /home/nvidia/mediapipe/__init__.py

AndreV84 avatar May 06 '21 19:05 AndreV84

`

ah, I see there is no instruction on how to make dist builds in the latter url, but on how to build for windows

I have to use this on a Jetson Nano, basically for Ubuntu 18.04

RohitSingh1226 avatar May 06 '21 20:05 RohitSingh1226

in my case the output is

python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'

NAME
    mediapipe

PACKAGE CONTENTS
    mediapipe (package)
    objectron
    setup

FILE
    /home/nvidia/mediapipe/__init__.py

rohit5466@Vicara:~/mediapipe/mediapipe$ python3 -c 'import mediapipe as mp; help(mp); print(mp.file)' Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

PACKAGE CONTENTS calculators (package) examples (package) framework (package) modules (package) python (package) util (package)

FILE /home/rohit5466/mediapipe/mediapipe/mediapipe/init.py

This is my updated output @jiuqiant @AndreV84

RohitSingh1226 avatar May 06 '21 20:05 RohitSingh1226

@RohitSingh1226 you may also reffer as to a reference to https://github.com/jiuqiant/mediapipe_python_aarch64 or to https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

@AndreV84 thanks for replying immediately, I Have tried to run and build the wheel on python by executing the command python3 setup.py gen_protos, I get the following error. Does this issue have something to do with the shebang inside the setup.py.

image

Any update on this? @jiuqiant @AndreV84 @sgowroji @cdibona

RohitSingh1226 avatar May 07 '21 08:05 RohitSingh1226

@RohitSingh1226 you may also reffer as to a reference to https://github.com/jiuqiant/mediapipe_python_aarch64 or to https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

@AndreV84 thanks for replying immediately, I Have tried to run and build the wheel on python by executing the command python3 setup.py gen_protos, I get the following error. Does this issue have something to do with the shebang inside the setup.py. image

Any update on this? @jiuqiant @AndreV84 @sgowroji @cdibona

You don't have the proto compiler package. See the third step of https://github.com/jiuqiant/mediapipe_python_aarch64#readme.

jiuqiant avatar May 07 '21 17:05 jiuqiant

in my case the output is

python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'

NAME
    mediapipe

PACKAGE CONTENTS
    mediapipe (package)
    objectron
    setup

FILE
    /home/nvidia/mediapipe/__init__.py

rohit5466@Vicara:~/mediapipe/mediapipe$ python3 -c 'import mediapipe as mp; help(mp); print(mp.file)' Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

PACKAGE CONTENTS calculators (package) examples (package) framework (package) modules (package) python (package) util (package)

FILE /home/rohit5466/mediapipe/mediapipe/mediapipe/init.py

This is my updated output @jiuqiant @AndreV84

home/rohit5466/mediapipe/mediapipe/mediapipe/__init__.py seems incorrect since the init.py is not in a python site-packages directory. Can you go to the root directory and run $ python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'?

jiuqiant avatar May 07 '21 18:05 jiuqiant

in my case it is as follows. I am also trying to figure out how to settle python mediapipe

Help on package mediapipe:

NAME
    mediapipe - Copyright 2019 - 2020 The MediaPipe Authors.

DESCRIPTION
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    
         http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

PACKAGE CONTENTS
    examples (package)
    framework (package)
    gpu (package)
    python (package)
    util (package)

FILE
    /home/user/mediapipe/mediapipe/__init__.py

root folder of mediapipe or root folder of the system? the above is from fodler of mediapipe while the below is from folder of the system




Help on package mediapipe:

NAME
    mediapipe

PACKAGE CONTENTS
    mediapipe (package)
    objectron
    setup

FILE
    /home/nvidia/mediapipe/__init__.py

(END)

AndreV84 avatar May 07 '21 19:05 AndreV84

I realize that we need to avoid running python interpreter in any parent direcotry of mediapipe. Otherwise, the mediapipe directory will confuse the python interpreter...

For example, I stay in ~/mediapipe after building and installing mediapipe python on my jetson nx. I will get

~/mediapipe$ python3 -m install attrs
~/mediapipe$ python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'

Help on package mediapipe:

NAME
    mediapipe - Copyright 2019 - 2020 The MediaPipe Authors.

DESCRIPTION
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specifi

PACKAGE CONTENTS
    examples (package)
    framework (package)
    gpu (package)
    python (package)
    util (package)

FILE
    /home/jiuqiant/mediapipe/mediapipe/__init__.py

If I go to ~/Desktop, which is not a parent directory of mediapipe. I can see that the mediapipe python package is in python3.8/dist-packages/, which is what I expected it to be.

~/Desktop$ python3 -c 'import mediapipe as mp; help(mp); print(mp.file)'

Help on package mediapipe:

NAME
    mediapipe - Copyright 2019 - 2020 The MediaPipe Authors.

DESCRIPTION
Help on package mediapipe:

NAME
    mediapipe - Copyright 2019 - 2020 The MediaPipe Authors.

DESCRIPTION
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

PACKAGE CONTENTS
    calculators (package)
    examples (package)
    framework (package)
    gpu (package)
    modules (package)
    python (package)
    util (package)

SUBMODULES
    packet_creator
    packet_getter
    resource_util
    solutions

FILE
    /usr/local/lib/python3.8/dist-packages/mediapipe/__init__.py

jiuqiant avatar May 10 '21 01:05 jiuqiant

@jiuqiant good catch! could you also share steps on building pythin whl on jetson nx, please?

AndreV84 avatar May 10 '21 04:05 AndreV84

@jiuqiant good catch! could you also share steps on building pythin whl on jetson nx, please?

I followed https://github.com/jiuqiant/mediapipe_python_aarch64#step-to-build-mediapipe-python-on-aarch64-ubuntu-2004 to build the python wheel package and it went well. Also, step 6 & 7 can be ignored since opencv aarch64 package is now available.

jiuqiant avatar May 10 '21 16:05 jiuqiant

Hi @RohitSingh1226, Could you please respond to the above comment and share us the issue status. Thanks!

sgowroji avatar May 21 '21 10:05 sgowroji

It isn’t working out, I have included multiple files and imported mediapipe as a class from somw other files. Is it because of that? Cause the error comes in the second file not the main.py

On Fri, 21 May 2021 at 4:04 PM, GowrojiSunil @.***> wrote:

Hi @RohitSingh1226 https://github.com/RohitSingh1226, Could you please respond to the above comment and share us the issue status. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/mediapipe/issues/1982#issuecomment-845855454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISFHNMSRRNLWP6X2CQLWCDTOYZK3ANCNFSM44EQBQ7A .

RohitSingh1226 avatar May 21 '21 10:05 RohitSingh1226

@RohitSingh1226 do you need it with python/ c or basel? both? neither of the two?

AndreV84 avatar May 21 '21 11:05 AndreV84

Hi @RohitSingh1226, This issue is fixed in the latest release of mediapipe 0.8.11, Could you please let us know if this is still an issue at your end. Thank you!

kuaashish avatar Sep 15 '22 08:09 kuaashish

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Sep 22 '22 09:09 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Sep 29 '22 10:09 google-ml-butler[bot]

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

google-ml-butler[bot] avatar Sep 29 '22 10:09 google-ml-butler[bot]

Hi @RohitSingh1226, This issue is fixed in the latest release of mediapipe 0.8.11, Could you please let us know if this is still an issue at your end. Thank you!

Hi @RohitSingh1226 In MP v0.8.11 which version of bazel I need to use?

VieiraJardel avatar Sep 12 '23 13:09 VieiraJardel