How to Let TD always catch the lastest numpy version

My TD version is 2021.13610
I have install python 3.7.2 and pip install mediapipe
and also install numpy 1.17

but when I import some python modules
Textport always show
import error (ImportError: Matplotlib requires numpy>=1.17; you have 1.16.2)

so i need to type this first
import sys
sys.path.insert(0, “C:/Users/user/AppData/Local/Programs/Python/Python37/Lib/site-packages”)
import numpy
print(numpy.version)

and reopen TD,but this is inconvenient

is there a easy way to fix it?

hey @huber0203, welcome to the forum.

use an Execute DAT to execute your Python code to set the correct path on project startup.

Thanks to @noones_img I updated TD-PIP so that TD searches the local lib folder first. So using TD-PIP to install numpy for your project will override the native TD-Version.
Simply place td-pip in your project and call
numpy = op.pip.Import_Module( “numpy” )
before importing mediapipe.

just simply copy the NumPy folder (updated version) at C:/Users/user/AppData/Local/Programs/Python/Python37/Lib/site-packages

to

NumPy folder at C:\Program Files\Derivative\TouchDesigner.2021.13610\bin\Lib\site-packages\

restart TD, and you’re ready to go!

1 Like