stylegan2-pytorch icon indicating copy to clipboard operation
stylegan2-pytorch copied to clipboard

fused_act problem, ninja build stopped, because cannot open file 'python310.lib'

Open kangjh0226 opened this issue 2 years ago • 3 comments

Thanks for the code. Does anybody have had same problem with me? I got problem on fused_act.py and upfirdn2d.py here is my error message:

File "E:\face\code\pytorchNo1\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1740, in _run_ninja_build subprocess.run( File "C:\Users\YJJEON\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "E:\face\code\Barbershop-main\main.py", line 13, in from models.Embedding import Embedding File "E:\face\code\Barbershop-main\models\Embedding.py", line 3, in from models.Net import Net File "E:\face\code\Barbershop-main\models\Net.py", line 3, in from models.stylegan2.model import Generator File "E:\face\code\Barbershop-main\models\stylegan2\model.py", line 11, in from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d File "E:\face\code\Barbershop-main\models\stylegan2\op_init_.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "E:\face\code\Barbershop-main\models\stylegan2\op\fused_act.py", line 11, in fused = load( File "E:\face\code\pytorchNo1\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1144, in load return _jit_compile( File "E:\face\code\pytorchNo1\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1357, in _jit_compile _write_ninja_file_and_build_library( File "E:\face\code\pytorchNo1\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1469, in _write_ninja_file_and_build_library _run_ninja_build( File "E:\face\code\pytorchNo1\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1756, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'fused': [1/1] "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64/link.exe" fused_bias_act.o fused_bias_act_kernel.cuda.o /nologo /DLL c10.lib c10_cuda.lib torch_cpu.lib torch_cuda_cu.lib -INCLUDE:?_torch_cuda_cu_linker_symbol_op_cuda@native@at@@YA?AVTensor@2@AEBV32@@Z torch_cuda_cpp.lib -INCLUDE:?warp_size@cuda@at@@YAHXZ torch.lib /LIBPATH:E:\face\code\pytorchNo1\venv\lib\s ite-packages\torch\lib torch_python.lib /LIBPATH:E:\face\code\pytorchNo1\venv\Scripts\libs "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\lib/x64" cudart.lib /out:fused.pyd FAILED: fused.pyd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64/link.exe" fused_bias_act.o fused_bias_act_kernel.cuda.o /nologo /DLL c10.lib c10_cuda.lib torch_cpu.lib torch_cuda_cu.lib -INCLUDE :?_torch_cuda_cu_linker_symbol_op_cuda@native@at@@YA?AVTensor@2@AEBV32@@Z torch_cuda_cpp.lib -INCLUDE:?warp_size@cuda@at@@YAHXZ torch.lib /LIBPATH:E:\face\code\pytorchNo1\venv\lib\site-packages\torch\lib torch_python.lib /LIBPATH:E:\fa ce\code\pytorchNo1\venv\Scripts\libs "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\lib/x64" cudart.lib /out:fused.pyd LINK : fatal error LNK1104: cannot open file 'python310.lib'. ninja: build stopped: subcommand failed.

Thank you!

kangjh0226 avatar Jul 04 '22 08:07 kangjh0226

Hello! I encountered the same problem, @kangjh0226, and managed to find a workaround:

You need to copy lib from your python path: ...\Python\Python310\libs\python310.lib

to your venv folder:

venv\Scripts\libs\python310.lib

I have no idea why it behaves like that but somehow it works for me

OzoneReloaded avatar Jul 22 '22 02:07 OzoneReloaded