[Solved] Win32api import

There are already several topic, but still no solution. Installed with pip install pywin32
No way to import with venv (all sys pathes added + extra path like here). This doesn’t work even in global py installation and provided path with TD settings dialog.

Some git repos hardcoded with this dependencies (like TensorRT), so there is no way to avoid pywin32 module. Yes, it can be launched in separated process, but in this case it comes to GPU-to-CPU-to-GPU process (like NDI), while it can be full in GPU in TD.

Hi @olegchomp

It’s not a dependency of TensorRT.

Where do you see this ? Which repo ?

Follow the Anaconda tutorial: https://derivative.ca/community-post/tutorial/anaconda-managing-python-environments-and-3rd-party-libraries-touchdesigner
Then install TensorRT following Nvidia’s guide: Quick Start Guide :: NVIDIA Deep Learning TensorRT Documentation

Just tested from TD:

python >>> import tensorrt
python >>> tensorrt
<module 'tensorrt' from 'E:\\_DERIVATIVE\\Experiments\\TensorRTTest\\Miniconda3\\envs\\TDTensorRT/Lib/site-packages\\tensorrt\\__init__.py'>
python >>> print(tensorrt.__version__)
10.0.1
python >>> assert tensorrt.Builder(tensorrt.Logger())

Thank you for quick answer.

Yes, tensorrt module doesn’t required it. But provided pipelines from TRT required cuda, which have dependencies of pywin32.

Hi @olegchomp

It makes perfect sense that cuda is a TensorRT dependency. I’m not seeing pywin32 being a requirement of either cuda or cuda-python though, and I wouldn’t trust a 2022 issue with no comment or feedback from Nvidia as a source of truth here.

Can you provide which repository / demo require pywin32 for you ?

Is it the following link ? TensorRT/demo/Diffusion/demo_txt2img_xl.py at release/10.0 · NVIDIA/TensorRT · GitHub

Best,
Michel

I reached the same error trying to install what you pointed to.

My take is that it’s a whole version conflict originating from what Nvidia is distributing for those demos at the moment.

They said renaming nvidia-ammo last week to become nvidia-modelopt.

They are multiple issues installing following demos\requirements.txt.

pip install cuda-python is ok while the other recommended solution via conda fails at the moment.

I’m still investigating but even in it’s own Python environment, it’s a pain to run, and I’m guessing the issue doesn’t have to do with TouchDesigner here.

Sorry for creating bug report before making research. After some testing, removed completely cuda dependencies and looks like it helped.

Which cuda dependency did you remove ? @olegchomp

pycuda? cuda-python?

cuda-python.
I’ve commented everything realted to it in inference part. It was mostly related to cuda_graph

1 Like