Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build CUDA kernels for upfirdn2d #94

Open
LiJT opened this issue Jun 26, 2023 · 4 comments
Open

Failed to build CUDA kernels for upfirdn2d #94

LiJT opened this issue Jun 26, 2023 · 4 comments

Comments

@LiJT
Copy link

LiJT commented Jun 26, 2023

Failed to build CUDA kernels for upfirdn2d....

`Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\bias_act.py", line 48, in _init
_plugin = custom_ops.get_plugin('bias_act_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for bias_act. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Registering hook for: b256
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
File "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py", line 64, in get_plugin
raise RuntimeError(f'Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "{file}".')
RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer. Check _find_compiler_bindir() in "C:\Users\charl\miniconda3\envs\draggan\lib\site-packages\draggan\stylegan2\torch_utils\custom_ops.py".

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Successfully loaded, starting gradio demo
Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().`

Could you please tell me how to fix this? It runs extremely slow

@LiJT LiJT changed the title Multiple Errors starting the server Failed to build CUDA kernels for upfirdn2d Jun 26, 2023
@Zeqiang-Lai
Copy link
Collaborator

As the message say

RuntimeError: Could not find MSVC/GCC/CLANG installation on this computer.

@baiyutang
Copy link

+1

@baiyutang
Copy link

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
/data/anaconda3/envs/draggan/lib/python3.7/site-packages/draggan/stylegan2/torch_utils/ops/upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last):
  File "/data/anaconda3/envs/draggan/lib/python3.7/site-packages/draggan/stylegan2/torch_utils/ops/upfirdn2d.py", line 32, in _init
    _plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
  File "/data/anaconda3/envs/draggan/lib/python3.7/site-packages/draggan/stylegan2/torch_utils/custom_ops.py", line 110, in get_plugin
    torch.utils.cpp_extension.load(name=module_name, verbose=verbose_build, sources=sources, **build_kwargs)
  File "/data/anaconda3/envs/draggan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1296, in load
    keep_intermediates=keep_intermediates)
  File "/data/anaconda3/envs/draggan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1534, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "/data/anaconda3/envs/draggan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1936, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /root/.cache/torch_extensions/py37_cu117/upfirdn2d_plugin/upfirdn2d_plugin.so: cannot open shared object file: No such file or directory

@Jallisto
Copy link

I fixed this RuntimeError for myself today.

However I'm not a professional programmer, so my advice is limited, but I can tell you what I did.

I previously installed Anaconda3, CUDA Toolkit 11.8 and had already Visual Studio 2022 on my computer.
Based on various sources (including those provided below) and digging through some of the files, I figured there might be some problem with the current installations of CUDA and Visual Studio. So I uninstalled everything and reinstalled the older versions of CUDA Toolkit 11.7 and Visual Studio 2019. I also removed Anaconda3 en reinstalled Miniconda3 just in case some corrupt files might be left behind. After this the error was gone.

These are the sources I used:
Failed to build CUDA kernels for upfirdn2d. UserWarning: Failed to build CUDA kernels for upfirdn2d. #155
Here they give advice to reinstall many components, including the CUDA Toolkit. Some people also recommend using Visual Studio 2019 instead of 2022.
Add Windows support for MSVC compiler path search #17
This source recommends adding code to the custom_ops.py file (I tried this, but because I was having other errors as well I'm not sure if it worked and I decided to reinstall everything instead).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants