ImportError : torch.utils.ffi is deprecated. Please use cpp extensions instead

My Code =

from torch.utils.ffi import _wrap_function
from .__ext import lib as _lib, ffi as _ffi

all = []
def _import_symbols(locals):
for symbol in dir(_lib):
fn = getattr(_lib, symbol)
if callable(fn):
locals[symbol] = _wrap_function(fn, _ffi)
locals[symbol] = fn


I get this error =

ImportError(“torch.utils.ffi is deprecated. Please use cpp extensions instead.”)

how can I solve this error?

This tutorial shows how to use custom CPP extensions.

I have a code written in python 2.7, and I want to execute it in python 3.7. I have a error in compiling “” says this: AttributeError: ‘MSVCCompiler’ object has no attribute ‘compiler_so’
Can you help me with that?

Based on this post it seems as if you are trying to build a Linux lib. Which PyTorch version are you using?

The pytorch version is 1.10.1. And I use CUDA version 11.6.0_511.23. I got a file from this github link: GitHub - GRAP-UdL-AT/RGBD_fruit_detection_faster-rcnn.pytorch, and had trouble creating roi_crop, roi_pooling, roi_align and NMS modules.

The repository seems to be quite old now based on the last commits (3 years ago) and these requirements:

    Python 2.7
    Pytorch 0.2.0
    CUDA 8.0 or higher

I assume you’ve forked the repo and applied some changes to use the new CPP extensions?

Yes, I got the following error: (“torch.utils.ffi is deprecated. Please use cpp extensions instead.”) and used CPP extensions according to this link:

Could you try to use the linked tutorial instead?

I studied the linked tutorial but did not come to a conclusion: |

Is there a problem with CPP extensions?