Import mediapipe worked in Terminal, but failed in TD

Hi, I was trying to import mediapipe in TouchDesigner. My python version is 3.11.

As you can see from below, I can import it successfully in my terminal:

However, I failed in TouchDesigner and got this error:
python >>> import mediapipe
ImportError: cannot import name ‘resource_util’ from ‘mediapipe.python._framework_bindings’ (unknown location)

Anybody came across the same issue? Any solution or idea?

Thanks!

Hey @Naive_Cross

Did you follow any of the instructions here: Category:Python - Derivative

Thanks,
Michel

Hi Michel,

I tried the instruction you shared. It seems that mediapipe is not found in brew:
Warning: No available formula with the name “mediapipe”. Did you mean media-info?

Also tried use pip install in python3.9 (instead of 3.11). However, when importing mediapipe in TD, this error raised:
mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’

Do you have any idea how to fix this? (Is it about my TD version? It’s non-comercial 64-bit 2022.29850)

Thanks!

Is your Mac a Mac Intel or Mac M1 ?

If so you need to make sure that your pipeline is using only one architecture.

If you are on an M1:

  • TD Build is the ARM / M1 Build, use the latest version. 2022.29850 is old already.
  • Python installed through brew needs to be the ARM version, version 3.9.5, since that’s the version that match TouchDesigner
  • Mediapipe needs to be installed in the Python ARM ecosystem

With all that, you should be able to import in TouchDesigner.

This is documented at the previously shared link.

Best,
Michel