如何让python项目运行(似乎c++编译器出了问题)

问题描述 投票:0回答:0

项目链接: https://github.com/e4s2022/e4s 错误日志:

Traceback (most recent call last):
  File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1808, in _run_ninja_build
    subprocess.run(
  File "/home/hou/anaconda3/envs/e4s/lib/python3.8/subprocess.py", line 516, 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 "scripts/face_swap.py", line 16, in <module>
    from src.pretrained.gpen.gpen_demo import init_gpen_pretrained_model, GPEN_demo
  File "/home/hou/code/e4s-main/src/pretrained/gpen/gpen_demo.py", line 15, in <module>
    from src.pretrained.gpen.face_enhancement import FaceEnhancement
  File "/home/hou/code/e4s-main/src/pretrained/gpen/face_enhancement.py", line 11, in <module>
    from src.pretrained.gpen.face_model.face_gan import FaceGAN
  File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/face_gan.py", line 14, in <module>
    from src.pretrained.gpen.face_model.gpen_model import FullGenerator, FullGenerator_SR
  File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/gpen_model.py", line 16, in <module>
    from src.pretrained.gpen.face_model.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
  File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/fused_act.py", line 13, in <module>
    fused = load(
  File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1202, in load
    return _jit_compile(
  File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1425, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1537, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1824, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'fused': [1/2] /usr/bin/nvcc  -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/TH -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/THC -isystem /home/hou/anaconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o 
FAILED: fused_bias_act_kernel.cuda.o 
/usr/bin/nvcc  -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/TH -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/THC -isystem /home/hou/anaconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o 
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&& __f)
      |                                                                                                                                                 ^ 
/usr/include/c++/11/bits/std_function.h:435:145: note:         ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
  530 |         operator=(_Functor&& __f)
      |                                                                                                                                                  ^ 
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’
ninja: build stopped: subcommand failed.

我做了什么: 我使用 yml 构建 conda 环境,但是当我运行代码时它会要求 Ninja。所以我安装了一个,然后就出现这个错误日志。

有人可以告诉我如何让这个项目成功运行吗?

python c++ deep-learning computer-vision deep-fake
© www.soinside.com 2019 - 2024. All rights reserved.