DragGAN icon indicating copy to clipboard operation
DragGAN copied to clipboard

Error launching after installing requirements

Open crazygonuts opened this issue 2 years ago • 13 comments

Not sure what exactly this means, all the requirements installed correctly.

python gradio_app.py
No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1'
D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
Traceback (most recent call last):
  File "D:\AIModels\Art\GAN\DragGAN\gradio_app.py", line 9, in <module>
    from drag_gan import drag_gan, stylegan2
  File "D:\AIModels\Art\GAN\DragGAN\drag_gan.py", line 12, in <module>
    from stylegan2.model import Generator
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\model.py", line 8, in <module>
    from .op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\op\__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\op\fused_act.py", line 11, in <module>
    fused = load(
  File "D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1509, in _jit_compile
    _write_ninja_file_and_build_library(
  File "D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1611, in _write_ninja_file_and_build_library
    _write_ninja_file_to_build_library(
  File "D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py", line 2007, in _write_ninja_file_to_build_library
    cuda_flags = common_cflags + COMMON_NVCC_FLAGS + _get_cuda_arch_flags()
  File "D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1773, in _get_cuda_arch_flags
    arch_list[-1] += '+PTX'
IndexError: list index out of range

crazygonuts avatar May 24 '23 07:05 crazygonuts

See https://github.com/Zeqiang-Lai/DragGAN/issues/14#issuecomment-1559148352

Zeqiang-Lai avatar May 24 '23 07:05 Zeqiang-Lai

CUDA and visual studio are already installed. I reinstalled anyways, but am still getting the same error. I am on windows 10.

crazygonuts avatar May 24 '23 08:05 crazygonuts

Same here. Worked fine with the old version of this drag gan from a few days ago. new one can't find cuda either. And i have cuda 11 installed, path's setup properly and everything. And works perfectly fine with any other diffusion related image generator.

image image image

DuckersMcQuack avatar May 24 '23 12:05 DuckersMcQuack

Hello, I have the same issue on my side too. Ideas? Thank you

werwack avatar May 24 '23 13:05 werwack

Try install torch with cuda support if it doesn't. My cmd is pip install torch==2.0.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118

raiden2012 avatar May 24 '23 16:05 raiden2012

Try install torch with cuda support if it doesn't. My cmd is pip install torch==2.0.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118

tried this, torch was already installed so it reinstalled but the error is still there

crazygonuts avatar May 25 '23 02:05 crazygonuts

Hello, I have the same issue on my side too. any ideas? Thank you

Anastasia-Zyh avatar May 25 '23 06:05 Anastasia-Zyh

same shit

gonduras avatar May 25 '23 10:05 gonduras

same shit

The latest version would automatically fallback to pytorch native implementation without custom op, which should not need CUDA toolkit anymore.

What the error messages do you face ?

Zeqiang-Lai avatar May 25 '23 10:05 Zeqiang-Lai

On latest ( 4015f1f ) I am now getting this:

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1'
D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
D:\AIModels\Art\GAN\DragGAN\stylegan2\op\fused_act.py:22: UserWarning: Fail to build torch extension, switch to native implementation
  warnings.warn(
D:\AIModels\Art\GAN\DragGAN\stylegan2\op\upfirdn2d.py:21: UserWarning: Fail to build torch extension, switch to native implementation
  warnings.warn(
Traceback (most recent call last):
  File "D:\AIModels\Art\GAN\DragGAN\gradio_app.py", line 10, in <module>
    from stylegan2.inversion import inverse_image
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\inversion.py", line 12, in <module>
    from .lpips import util
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\util.py", line 11, in <module>
    from . import dist_model
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\dist_model.py", line 12, in <module>
    from .base_model import BaseModel
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\base_model.py", line 6, in <module>
    from IPython import embed
ModuleNotFoundError: No module named 'IPython'

crazygonuts avatar May 26 '23 02:05 crazygonuts

On latest ( 4015f1f ) I am now getting this:

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1'
D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
D:\AIModels\Art\GAN\DragGAN\stylegan2\op\fused_act.py:22: UserWarning: Fail to build torch extension, switch to native implementation
  warnings.warn(
D:\AIModels\Art\GAN\DragGAN\stylegan2\op\upfirdn2d.py:21: UserWarning: Fail to build torch extension, switch to native implementation
  warnings.warn(
Traceback (most recent call last):
  File "D:\AIModels\Art\GAN\DragGAN\gradio_app.py", line 10, in <module>
    from stylegan2.inversion import inverse_image
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\inversion.py", line 12, in <module>
    from .lpips import util
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\util.py", line 11, in <module>
    from . import dist_model
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\dist_model.py", line 12, in <module>
    from .base_model import BaseModel
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\base_model.py", line 6, in <module>
    from IPython import embed
ModuleNotFoundError: No module named 'IPython'
pip install IPython

this should fix it. we will update the package soon

Zeqiang-Lai avatar May 26 '23 03:05 Zeqiang-Lai

On latest ( 4015f1f ) I am now getting this:

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1'
D:\AIModels\Art\GAN\DragGAN\venv\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
D:\AIModels\Art\GAN\DragGAN\stylegan2\op\fused_act.py:22: UserWarning: Fail to build torch extension, switch to native implementation
  warnings.warn(
D:\AIModels\Art\GAN\DragGAN\stylegan2\op\upfirdn2d.py:21: UserWarning: Fail to build torch extension, switch to native implementation
  warnings.warn(
Traceback (most recent call last):
  File "D:\AIModels\Art\GAN\DragGAN\gradio_app.py", line 10, in <module>
    from stylegan2.inversion import inverse_image
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\inversion.py", line 12, in <module>
    from .lpips import util
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\util.py", line 11, in <module>
    from . import dist_model
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\dist_model.py", line 12, in <module>
    from .base_model import BaseModel
  File "D:\AIModels\Art\GAN\DragGAN\stylegan2\lpips\base_model.py", line 6, in <module>
    from IPython import embed
ModuleNotFoundError: No module named 'IPython'
pip install IPython

this should fix it. we will update the package soon

Just did, still the same as the lads above.

DuckersMcQuack avatar Jun 14 '23 02:06 DuckersMcQuack

I'm getting the same error. Looking into the cpp_extension.py I get this;

def get_compiler_abi_compatibility_and_version(compiler) -> Tuple[bool, TorchVersion]: r''' Determine if the given compiler is ABI-compatible with PyTorch alongside its version.

Args:
    compiler (str): The compiler executable name to check (e.g. ``g++``).
        Must be executable in a shell process.

Returns:
    A tuple that contains a boolean that defines if the compiler is (likely) ABI-incompatible with PyTorch,
    followed by a `TorchVersion` string that contains the compiler version separated by dots.
'''
if not _is_binary_build():
    return (True, TorchVersion('0.0.0'))
if os.environ.get('TORCH_DONT_CHECK_COMPILER_ABI') in ['ON', '1', 'YES', 'TRUE', 'Y']:
    return (True, TorchVersion('0.0.0'))

# First check if the compiler is one of the expected ones for the particular platform.
if not check_compiler_ok_for_platform(compiler):
    warnings.warn(WRONG_COMPILER_WARNING.format(
        user_compiler=compiler,
        pytorch_compiler=_accepted_compilers_for_platform()[0],
        platform=sys.platform))
    return (False, TorchVersion('0.0.0'))

if IS_MACOS:
    # There is no particular minimum version we need for clang, so we're good here.
    return (True, TorchVersion('0.0.0'))
try:
    if IS_LINUX:
        minimum_required_version = MINIMUM_GCC_VERSION
        versionstr = subprocess.check_output([compiler, '-dumpfullversion', '-dumpversion'])
        version = versionstr.decode(*SUBPROCESS_DECODE_ARGS).strip().split('.')
    else:
        minimum_required_version = MINIMUM_MSVC_VERSION
        compiler_info = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
        match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode(*SUBPROCESS_DECODE_ARGS).strip())
        version = ['0', '0', '0'] if match is None else list(match.groups())
except Exception:
    _, error, _ = sys.exc_info()
    warnings.warn(f'Error checking compiler version for {compiler}: {error}')
    return (False, TorchVersion('0.0.0'))

if tuple(map(int, version)) >= minimum_required_version:
    return (True, TorchVersion('.'.join(version)))

compiler = f'{compiler} {".".join(version)}'
warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))

return (False, TorchVersion('.'.join(version)))

It seems to me like there isn't an ABI compatability option for Windows (maybe?) (I'm a noob. does this make any sense?)

ovanderz avatar Sep 30 '23 00:09 ovanderz