Overriding numpy

Hey all,

I’m trying to import then pandas module which requires Numpy 1.12 or greater. I have Numpy 1.16 on laptops python path, but the version TD comes installed with is 1.11.

I was looking in the docs about overriding built in modules, but I’m still confused and couldn’t get it to work - derivative.ca/wiki088/index. … ng_Modules

Does anyone know of a way I can get TD to use the Numpy version on my system, rather than the numpy built into TD?

Thanks in advance!

You could try changing the sys.path so that the path to your numpy version is before the path to our numpy version. Does that work?

Hey Malcom,

Could you be more specific as to how to do that? sys.path just yields a list of various python related folders, along with the site packages TD uses - it doesn’t seem to go to the module level.

see the chapter “Importing Modules” on the “introduction to Python Tutorial” page:
(more specifically the last paragraph titled “Overriding built in modules”)
docs.derivative.ca/Introduction … ng_Modules

Hey nettoyeur,

That article was what I was referring to in my original post - I read it, but I’m still confused as to how to actually implement it.

I ran sys.path.remove('C:\\Program Files\\Derivative\\TouchDesigner099\\bin\\lib\\site-packages')

and got a value error saying ValueError: list.remove(x): x not in list

I printed out sys.path and sure enough the site-packages path wasn’t in there - which confused me even more. If my the default TD sitepackages path isn’t in sys.path, then how is TD importing the default modules like cv2 and numpy?

I also tried

import sys
mypath = "C:\\Users\\myusername\\Desktop\\Python37\\Lib\\site-packages\\numpy"
sys.path.insert(0, mypath)
import numpy

Which did put numpy version 1.16 first in the sys.path, but when I printed numpy.__version it yielded version 1.11 - which is the TD default version

Try without the numpy portion:

import sys
sys.path.insert(0, "C:/Python35-x64/Lib/site-packages")
import numpy

This works for me.

(I’ve updated the wiki!)