pytorch / functorch

functorch is JAX-like composable function transforms for PyTorch.
https://pytorch.org/functorch/
BSD 3-Clause "New" or "Revised" License
1.39k stars 102 forks source link

Installation Issues on Windows #331

Open bchen0 opened 2 years ago

bchen0 commented 2 years ago

Hi, I've been having some issues with installation on Windows and was hoping to get some help. I have Pytorch 1.10 (cuda 10.2) installed and have tried both the main and preview versions, and with and without ninja. I've attached the full log file below (preview, with ninja).

Any help would be appreciated. Thanks! log_file.txt

zou3519 commented 2 years ago

Thanks for the bug report @bchen0 and the detailed log file!

We don't have Windows machines handy (I'll work on getting one...) so this may take some iteration, but from reading your error message, I issued a potential fix (https://github.com/pytorch/functorch/commit/bb7c6ba0dd1f58b863aebd8d8e5e1b910f8a6fce).

Could you please try to re-install functorch using the updated main branch and let us know if that resolves the build failure or if there is another error?

bchen0 commented 2 years ago

Thanks Richard. I've tried re-installing using the updated main branch (with the nightly Pytorch binary) and end up getting a different error. The log file is attached: log_file.txt

zou3519 commented 2 years ago

Can you print out the version of your nightly PyTorch? It looks like it might not be up-to-date; from the logs the nightly PyTorch binary looks like it is missing some newer symbols that functorch relies on:

import torch
print(torch.__version__)

I also went in and deleted some more dead code that your error messages were referring to.

vfdev-5 commented 2 years ago

I was using MSEdge Win10 vbox image from : https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ and after installing pytorch nightly from 14 december + build tools etc, finally I got the following errors:

C:\Users\IEUser\functorch\functorch\csrc\BatchRulesDecompositions.cpp(56): error C2751: 'c10::DispatchKey::Functionalize': the name of a function parameter cannot be qualified

and if I comment out this line, compiling passes but linker fails:

creating C:\Users\IEUser\functorch\build\lib.win32-3.8\functorch
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.30.30705\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\IEUser\miniconda3\lib\site-packages\torch\lib /LIBPATH:C:\Users\IEUser\miniconda3\libs /LIBPATH:C:\Users\IEUser\miniconda3\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.30.30705\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\\um\x86" c10.lib torch.lib torch_cpu.lib torch_python.lib /EXPORT:PyInit__C C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesUnaryOps.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesDynamic.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\PlumbingHelper.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\DynamicLayer.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\init.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesNorm.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesLinearAlgebra.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesViews.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\PyTorchOperatorHacks.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchedFallback.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesScatterOps.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesBinaryOps.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchedTensorImpl.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesReduceOps.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesModules.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesDecompositions.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\VmapModeRegistrations.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\CompileCache.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchingRegistrations.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesHelper.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesFactory.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\OutOfPlacePlumbing.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesPooling.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\CustomFunction.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\PointwiseOperatorCompileCache.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\TensorWrapper.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\VmapTransforms.obj C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\BatchRulesLoss.obj /OUT:build\lib.win32-3.8\functorch\_C.pyd /IMPLIB:C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\_C.lib
   Creating library C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\_C.lib and object C:\Users\IEUser\functorch\build\temp.win32-3.8\Release\Users\IEUser\functorch\functorch\csrc\_C.exp
BatchRulesUnaryOps.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class at::Tensor __cdecl at::_ops::atan::call(class at::Tensor const &)" (__imp_?call@atan@_ops@at@@SA?AVTensor@3@ABV43@@Z)
BatchRulesUnaryOps.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class at::Tensor __cdecl at::_ops::sin::call(class at::Tensor const &)" (__imp_?call@sin@_ops@at@@SA?AVTensor@3@ABV43@@Z)
BatchRulesUnaryOps.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class at::Tensor __cdecl at::_ops::isneginf::call(class at::Tensor const &)" (__imp_?call@isneginf@_ops@at@@SA?AVTensor@3@ABV43@@Z)
BatchRulesUnaryOps.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class at::Tensor __cdecl at::_ops::relu::call(class at::Tensor const &)" (__imp_?call@relu@_ops@at@@SA?AVTensor@3@ABV43@@Z)

...
build\lib.win32-3.8\functorch\_C.pyd : fatal error LNK1120: 1041 unresolved externals
zou3519 commented 2 years ago

Hmm... maybe something is up with visibility macros for the at::_ops:: namespace? cc @bdhirsh if you have any ideas