Td pip - 2020-08-07 23:19

TD PIP

Link to main site

1 Like

oh, this is nice!
Question: when using ā€œImport_Module()ā€ how do I perform a import qrcode as qr ?

Thanks

Import_Module is the equivilant of import as, so you just write qr = op(ā€˜pipā€™).Import_Module( ā€˜qrcodeā€™ ) and then use qr as if you used the import as statement.

thx @alphamoonbase. That is pretty elegant solution.

Thanks, glad you like it. The question of how to get PIP to work with TD just came up to often so i had to take a shot :slight_smile:

A little update: I was under the assumption that the names in pip and the module names are the same, which is in fact not the case.
The Import_Module method offers now an optionaƶ pip_name argument to define the package name seperate from the module name.

1 Like

I updated the PIP-Version. (I need to find a way to do that dynamiclyā€¦) and now default install setuptools with the first init routine !

Hey All,

Iā€™m having a bit of trouble here. After starting and saving a new .toe, I dropped TD_PIP.tox into that same folder, then drag the TD_PIP.tox onto my network editor, which creates the TD_PIP base.

I understand that TD_PIP is best used by scripting the module imports (op(ā€˜td_pipā€™).InstallPackage( package_name )), but I canā€™t even get it to work ā€˜manuallyā€™ by typing the name into ā€œpackageā€ param and clicking the ā€œinstallā€ pulse button.

For example, I am using ā€œpygletā€ package.

The ā€œcheckā€ pulse button works, and I receive ā€œpackage not installed.ā€ But when i click ā€œinstallā€ pulse button, nothing happens. I looked at the log inside of TD_PIP and it simply just says ā€œfailed installing package.ā€ I tried 3 other packages, no dice.

What OS are you o?

Mac OS 12.2.1

TD Pip is not supported on MacOS for the forseeable future.

This is just excellent. Great job, and thanks for sharing with us.

1 Like

Hi! Iā€™m new to external libaries in Touchdesigner. Iā€™ve tried using your .tox file and although it does create a lib folder, I canā€™t seem to get it to download packages. Iā€™ve tried using your example of
qrcode = op(ā€˜td_pipā€™).Import_Module(ā€œqrcodeā€)

I open a text dat and cut and paste that in then run script and then I check the lib folder but nothing new is there. I"ve tried putting qrcode into the packge parameter on the Custom page within the tox but that doesnā€™t seem to do anything either. It looks like my powershell on my computer opens momentarily but it closes before I can see whatā€™s happening. When I open powershell manually it doesnā€™t show any activity.

Iā€™m trying to use this repo: https://github.com/PetalTech/petal-api-getting-started/tree/master/python.

I tried opening a text DAT and running
op(ā€˜td_pipā€™).InstallPackage( petal-api-getting-started )
to which I got an error saying petal was not defined.
So I tried
petal = op(ā€˜td_pipā€™).Import_Module(ā€œpetal-api-getting-startedā€)
and received the following error:
AttributeError: ā€˜NoneTypeā€™ object has no attribute ā€˜Import_Moduleā€™

Could you point me in the right direction? Much appreciated. Iā€™d like to use your tool as it looks like such a good solution!

Kindest Regards,

E. Spencer Lewis

Heyho. Do you maybe have a .toe file for me to check?
Also, which OS are you using? Which TD Version are you rinning?
TD_PIP is currently not supported on MacOS.
Also, how does your libFolder look like?

Hi! When installing pip the installation fails, do you have any ideas why that could be?

Which OS are you on? How does it fail? Any more info?

Im running windows 10 on amd64, it throws an exception during installation of pip. Sometimes it works sometimes it doesnā€™t, I would love for it to be consistent

after looking a bit more into it, why donā€™t you just use the ensurepip module instead of using the wheels inside itā€™s source files?

Can you please set ā€œTOUCH_TEXT_CONSOLEā€ env variable to 1 and check what the output to narrow it down? Did not have any issues with that so need some more hints to ā€œmake it consistentā€.
Also, please post the exceptionā€¦

Regarding using ensurepip: There were reasons for not using it, but not sure right now, can revisit it.

EDIT: Did a quick test: The problem is that ensurepip opens a subprocess which in TD is a new TD-Instance instead of the python interprete, which results in an error.
Also, the unpacking is basicly 1 to 1 what the esnurePIP is doing.
grafik