rosinality / stylegan2-pytorch

Implementation of Analyzing and Improving the Image Quality of StyleGAN (StyleGAN 2) in PyTorch
MIT License
2.72k stars 620 forks source link

enviroment error? #140

Open 904281665 opened 3 years ago

904281665 commented 3 years ago

Hi~ thanks for your amazing work. I try to follow your work but I am currently experiencing some problems. Based on experience, I guess it should be an environmental problem. My enviroment:

Traceback (most recent call last): File "/home/dongshichao/.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1030, in _build_extension_module check=True) File "/usr/lib/python3.6/subprocess.py", line 438, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pudb/init.py", line 153, in runscript dbg._runscript(mainpyfile) File "/usr/local/lib/python3.6/dist-packages/pudb/debugger.py", line 468, in _runscript self.run(statement) File "/usr/lib/python3.6/bdb.py", line 434, in run exec(cmd, globals, locals) File "", line 1, in File "dsc_demo.py", line 18, in from models.psp import pSp File "../models/psp.py", line 9, in from models.encoders import psp_encoders File "../models/encoders/psp_encoders.py", line 8, in from models.stylegan2.model import EqualLinear File "../models/stylegan2/model.py", line 7, in from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d File "../models/stylegan2/op/init.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "../models/stylegan2/op/fused_act.py", line 13, in os.path.join(module_path, 'fused_bias_act_kernel.cu'), File "/home/dongshichao/.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 661, in load is_python_module) File "/home/dongshichao/.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 830, in _jit_compile with_cuda=with_cuda) File "/home/dongshichao/.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 883, in _write_ninja_file_and_build _build_extension_module(name, build_directory, verbose) File "/home/dongshichao/.local/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1043, in _build_extension_module raise RuntimeError(message) RuntimeError: Error building extension 'fused': [1/3] :/data/cuda/cuda-10.1/cuda/:/data/cuda/cuda-10.1/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/TH -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/THC -isystem :/data/cuda/cuda-10.1/cuda/:/data/cuda/cuda-10.1/cuda/include -isystem /usr/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++11 -c /data/jupyter/pixel2style2pixel/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o FAILED: fused_bias_act_kernel.cuda.o :/data/cuda/cuda-10.1/cuda/:/data/cuda/cuda-10.1/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/TH -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/THC -isystem :/data/cuda/cuda-10.1/cuda/:/data/cuda/cuda-10.1/cuda/include -isystem /usr/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++11 -c /data/jupyter/pixel2style2pixel/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o /bin/sh: 1: :/data/cuda/cuda-10.1/cuda/:/data/cuda/cuda-10.1/cuda/bin/nvcc: not found [2/3] c++ -MMD -MF fused_bias_act.o.d -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/TH -isystem /home/dongshichao/.local/lib/python3.6/site-packages/torch/include/THC -isystem :/data/cuda/cuda-10.1/cuda/:/data/cuda/cuda-10.1/cuda/include -isystem /usr/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /data/jupyter/pixel2style2pixel/models/stylegan2/op/fused_bias_act.cpp -o fused_bias_act.o ninja: build stopped: subcommand failed.

rosinality commented 3 years ago

Seems like that nvcc is not on your PATH. Please refer to this: https://askubuntu.com/questions/1127392/error-command-nvcc-not-found-but-can-be-installed-with-after-installing-cud