Trying to build the source using cmake with Visual Studio 2019 on Windows, pytorch version: 1.5.1, while compiling I get the error messages below. I have verified that e.g. typed is not a member of c10::OpeationHandle, am I mixing versions even though I use the latest torch and torchvision?
I used the command cmake --build . --config Release
D:\vision-master\torchvision\csrc\ROIAlign.h(29,30): error C2039: 'typed': is not a member of 'c10::OperatorHandle' [D:\vision-master\build\torchvision.vcxproj]
C:\Users\simon\AppData\Local\Programs\Python\Python37\Lib\site-packages\torch\include\ATen/core/dispatch/Dispatcher.h(179): message : see declaration of 'c10::OperatorHandle' [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\ROIAlign.h(29,50): error C2062: type 'at::Tensor (const at::Tensor &,const at::Tensor &,const double,const int64_t,const int64_t,const int64_t,const bool)' unexpected [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\ROIAlign.h(30,12): error C3536: 'op': cannot be used before it is initialized [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\ROIAlign.h(77,17): error C2039: 'typed': is not a member of 'c10::OperatorHandle' [D:\vision-master\build\torchvision.vcxproj]
C:\Users\simon\AppData\Local\Programs\Python\Python37\Lib\site-packages\torch\include\ATen/core/dispatch/Dispatcher.h(179): message : see declaration of 'c10::OperatorHandle' [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\ROIAlign.h(77,47): error C2062: type 'at::Tensor (const at::Tensor &,const at::Tensor &,const double,const int64_t,const int64_t,const int64_t,const int64_t,const int64_t,const int64_t,const int64_t,const bool)' unexpected [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\ROIAlign.h(78,12): error C3536: 'op': cannot be used before it is initialized [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\nms.h(19,30): error C2039: 'typed': is not a member of 'c10::OperatorHandle' [D:\vision-master\build\torchvision.vcxproj]
C:\Users\simon\AppData\Local\Programs\Python\Python37\Lib\site-packages\torch\include\ATen/core/dispatch/Dispatcher.h(179): message : see declaration of 'c10::OperatorHandle' [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\nms.h(19,44): error C2062: type 'at::Tensor (const at::Tensor &,const at::Tensor &,const double)' unexpected [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\nms.h(20,12): error C3536: 'op': cannot be used before it is initialized [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(45,15): error C2065: 'torchvision': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(45,28): error C2065: 'm': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(45,29): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(45,31): error C2448: 'TORCH_LIBRARY': function-style initializer appears to be a function definition [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(59,20): error C2065: 'torchvision': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(59,33): error C2065: 'CPU': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(59,38): error C2065: 'm': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(59,39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(59,41): error C2448: 'TORCH_LIBRARY_IMPL': function-style initializer appears to be a function definition [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(82,20): error C2065: 'torchvision': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(82,33): error C2065: 'Autograd': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(82,43): error C2065: 'm': undeclared identifier [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(82,44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(82,1): error C2374: 'TORCH_LIBRARY_IMPL': redefinition; multiple initialization [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(59): message : see declaration of 'TORCH_LIBRARY_IMPL' [D:\vision-master\build\torchvision.vcxproj]
D:\vision-master\torchvision\csrc\vision.cpp(82,46): error C2448: 'TORCH_LIBRARY_IMPL': function-style initializer appears to be a function definition [D:\vision-master\build\torchvision.vcxproj]
Hi @simonvaj in general the master branch from torchvision depends on the master of torch. I'm not in a position to tell if that is the problem here, but could you try to install torch from source or the preview (nightly) version and see if that solves your problem?
Hi @pmeier that did help, it was easy to install the nightly version of torch using pip with flag --ignore-installed. Now I know this is the relevant version to use. Thank you very much.
Most helpful comment
Hi @pmeier that did help, it was easy to install the nightly version of torch using pip with flag --ignore-installed. Now I know this is the relevant version to use. Thank you very much.