ModuleNotFoundError: mediapipe

Hi,
when trying to import the mediapipe python package (import mediapipe as mp) I get this error:

ModuleNotFoundError: No module named ‘mediapipe.python._framework_bindings’

I have already done ‘pip install mediapipe’ and set the python 64-bit module path in the TD settings to my anaconda modules folder, since that is where pip seemed to have installed it into. Yet even after restarting several times, I still get the error. I am not sure what I should do. I am running macOS Monterey. This wasn’t a problem on Windows at all, I didn’t even have to install mediapipe.

1 Like

similar issue on Windows 10

ModuleNotFoundError: No module named ‘mediapipe.python._framework_bindings’

Did you import your python install / anaconda environment as described on the following pages:

Installing custom python packages

Anaconda

I was able to install, import and run mediapipe without issues.

Yes, I had already followed both those tutorials you linked. I also tried installing a pyenv directly in the project folder, tried using TD-Pip
(the creator said it only works on Windows), and some other things that I can’t recall right now. I still get the same error.

Sorry - I missed the part where you mention MacOS…

I didn’t test Mediapipe on MacOS.

Is your Mac an M1 Mac or Intel?

Best,
Michel

1 Like

Hey Vivien,

I am experiencing the same issue,
did you manage to find a solution after all?
would be happy to hear

cheers,
Cor

Hey @Cor

Are you trying on Windows or MacOS ?

I recently confirmed that Mediapipe can run on Windows from within TouchDesigner.

Please note however that as far as I could tell, it is running on the CPU.

Best,
Michel

I am trying to run in it on windows, but this is the error I get outputted…. Maybe you could share your .fox file? Although I think something isn’t working within the media pipe installation?
Thanks for your reply!

Just look like some version compatibility issue, did you follow the link suggested?

You need install mediapipe-silicon, with python 3.9.
If you install media-pipe silicon with python 3.10, TD not found.

Mediapipe-silicon is for Apple Silicon, not Windows.

But yes, that’d be for 3.9, TD Python’s environment being Python 3.9.5 at the time of writing.

Yes, yes, I put mediapipe-silicon/python10 because I had the same error with Monterrey at M1 (like @viviensheep) in TD. When I made a new virtual environment with the pyhton9 (version of TD), and installed mediapipe-silicon again, the script load without error. I don’t understand the error.

Hey everyone,
Had this issue yesterday. It was mainly an issue of package versions. Went back to my conda terminal, and uninstalled and reinstalled all packages.

You should notice versions will actually update accordingly to whatever python version you’re using in your virtual environment (they were previously all the latest versions for me, hence the incompatibility).

Also just like @JetXS says, make sure you have an Execute DAT in your network with the correct paths to your virtual envs Library, DLLs and site-packages in the “onStart()” function.

This is what works for me:

import os
import sys

def onStart():
	username = 'YourSystemUsername'
	env = 'YourVirtualEnvName'
	os.environ['PATH'] += os.pathsep + f'C:\\Users\\{username}\\anaconda3\\envs\\{env}\\DLLs'
	os.environ['PATH'] += os.pathsep + f'C:\\Users\\{username}\\anaconda3\\envs\\{env}\\Library\\bin'

	sys.path = [f'C:\\Users\\{username}\\anaconda3\\envs\\{env}\\Lib\\site-packages'] + sys.path
	return

On project load, this script should run and will allow you to script with Mediapipe.
For a quick start with the library, look up Brian Chung’s GitHub for examples!

Best,
Mike