Question about THC\THC.h

I cloned a project from github which is NVlabs/wetectron.
And I follow the instruction to set the environment.
The ninja version is 1.10.2.3
conda version is 4.4.10
I use the following commend to download pytorch:
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
so I got pytorch-1.11.0 and cuda-10.2
And then I clone the apex from nvidia, things still work pretty well now
and when I install the ninja with symbolic links
Failed occur:
fatal error: THC/THC.h: No such file or directory
and another error is

I search in google but I didn’t found anything useful.
I am not sure about it was caused by version or I can just simply download the file and paste it somewhere

The TH/THC namespace is dead and apex also removed it already, so you should update apex to the latest version.

1 Like

Really appreciate for your help, but I think the problem is not caused by apex. I removed the conda environment and clone the apex using
git clone GitHub - NVIDIA/apex: A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch
and install it follow the commend as follow:
pip install -v --disable-pip-version-check --no-cache-dir --global-option="–cpp_ext" --global-option="–cuda_ext" ./
The error is still the same, but I found that, it is some csrc/cuda/***.cu file couldn’t find the THC, for example :SigmoidFocalLoss_cuda.cu deform_pool_cuda.cu ROIPool_cuda.cu. Maybe I can find a newer version of these function somewhere? Or any advice I can solve if.

I might have misunderstood the issue as I thought you are running into the building error in apex.
Based on the function names, it seems you are trying to build maskrcnn_benchmark, which still uses the deprecated import here so you might either want to update it or skip its build.

Thank you for your help, I think I have solve the problem. It is caused by version of torch and cudatool. I reinstall pytorch for many times from 1.01 to 1.4 to 1.6 and the project can work now. Besides, I wonder why when I use conda commend to install pytorch and I get the cpu only version.

i am currently facing the same problem, can you tell me what version of cuda and pytorch you used so i could solve it ?

Hi there, I have the same issue with building the mmdetection. Could you tell me how can I update it?
Thank you so much

You could check which deprecated TH(C) methods are currently used in the code base and migrate them to the new ATen API. I would guess that the majority of actual function names should be equal but in a new namespace now (or without the TH tag in their name).

1 Like

Cuda verison is 10.2, pytorch version is 1.6.0. remember to use the pip install commend from official website to install pytorch.