williamyang1991 / VToonify

[SIGGRAPH Asia 2022] VToonify: Controllable High-Resolution Portrait Video Style Transfer
Other
3.53k stars 441 forks source link

conda environment fails to install #38

Open inobrevi opened 1 year ago

inobrevi commented 1 year ago
conda env create -f ./environment/vtoonify_env.yaml
Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound:
  - python-lmdb==1.2.1=py38h2531618_1
  - scikit-image==0.18.1=py38ha9443f7_0
  - libfaiss==1.7.1=hb573701_0_cpu
  - libstdcxx-ng==9.3.0=h6de172a_19
  - pillow==8.3.1=py38h2c7a002_0
  - libedit==3.1.20191231=he28a2e2_2
  - pytorch==1.7.1=py3.8_cuda10.1.243_cudnn7.6.3_0
  - libgcc-ng==9.3.0=h2828fa1_19
  - ca-certificates==2022.2.1=h06a4308_0
  - python==3.8.3=cpython_he5300dc_0
  - certifi==2021.10.8=py38h06a4308_2
  - faiss==1.7.1=py38h7b17aaf_0_cpu
  - _libgcc_mutex==0.1=conda_forge
  - setuptools==49.6.0=py38h578d9bd_3
  - matplotlib-base==3.3.4=py38h62a2d02_0
  - libffi==3.2.1=he1b5a44_1007

Any info on that? The builds seem too specific.

inobrevi commented 1 year ago

after reducing builds I still get error with those:

ResolvePackageNotFound:
  - libstdcxx-ng=9.3.0
  - libedit=3.1
  - libgcc-ng=9.3.0
Inferencer commented 1 year ago

What operating system are you trying to run this on? A similar question was asked by a Windows user 22

inobrevi commented 1 year ago

Windows 10, I forgot to search for similar issue ( I assumed it would be mentioned in readme). I will try to install it manually and create requirements file for other interested people if successful.

hugosbnarciso commented 1 year ago

hi, i made it work on windows with the following steps:

conda env create --name vtoonify_env
conda activate vtoonify_env
conda install python=3.9
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia -c conda-forge
conda install libfaiss=1.7.1 -c conda-forge
conda install _libgcc_mutex=0.1 ca-certificates=2022.2.1 certifi=2021.10.8
conda install faiss=1.7.1 m2-libedit libfaiss-avx2=1.7.1
conda install libffi=3.2.1 -c conda-forge
conda install matplotlib-base=3.3.4 pillow=8.3.1 pip python-lmdb=1.2.1 setuptools=49.6.0 scikit-image=0.18.1
pip install cmake matplotlib ninja numpy opencv-python==4.5.3.56 scipy tqdm wget 
pip install "dlib-19.22.99-cp39-cp39-win_amd64.whl" (get it here: https://github.com/sachadee/Dlib)

i skipped libgcc-ng & libstdcxx-ng as they are not available for windows

seems to work with one error: :\VToonify\model\stylegan\op\conv2d_gradfix.py:88: UserWarning: conv2d_gradfix not supported on PyTorch 1.13.1. Falling back to torch.nn.functional.conv2d().

AlessandroRomanelli commented 1 year ago

Build is failing for me as well, I tried to install manually with a virtual environment using Python3.8.3 and the following list of dependencies:

Package            Version
------------------ -----------
certifi            2022.12.7
charset-normalizer 3.0.1
cmake              3.21.0
colorama           0.4.6
contourpy          1.0.7
cycler             0.11.0
dlib               19.21.0
fonttools          4.38.0
idna               3.4
imageio            2.24.0
kiwisolver         1.4.4
matplotlib         3.6.3
networkx           3.0
ninja              1.10.2
numpy              1.21.0
opencv-python      4.5.3.56
packaging          23.0
Pillow             8.3.1
pip                19.2.3
pyparsing          3.0.9
python-dateutil    2.8.2
PyWavelets         1.4.1
requests           2.28.2
scikit-image       0.18.1
scipy              1.7.0
setuptools         49.6.0
six                1.16.0
tifffile           2022.10.10
torch              1.7.1+cu101
torchaudio         0.7.2
torchvision        0.8.2+cu101
tqdm               4.61.2
typing-extensions  4.4.0
urllib3            1.26.14
wget               3.2

requirements.txt

I have CUDA runtime 10.1.243 (Update 2) installed but I'm having the following error:

Traceback (most recent call last):
  File "C:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1533, in _run_ninja_build
    subprocess.run(
  File "C:\Users\alero\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 512, 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 ".\style_transfer.py", line 11, in <module>
    from model.vtoonify import VToonify
  File "C:\Users\alero\Desktop\AI\VToonify\model\vtoonify.py", line 5, in <module>
    from model.stylegan.model import ConvLayer, EqualLinear, Generator, ResBlock
  File "C:\Users\alero\Desktop\AI\VToonify\model\stylegan\model.py", line 11, in <module>
    from model.stylegan.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix
  File "C:\Users\alero\Desktop\AI\VToonify\model\stylegan\op\__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "C:\Users\alero\Desktop\AI\VToonify\model\stylegan\op\fused_act.py", line 11, in <module>
    fused = load(
  File "C:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\utils\cpp_extension.py", line 986, in load
    return _jit_compile(
  File "C:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1193, in _jit_compile
    _write_ninja_file_and_build_library(
  File "C:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1297, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "C:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\utils\cpp_extension.py", line 1555, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'fused': [1/3] cl /showIncludes -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\TH -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -IC:\Users\alero\AppData\Local\Programs\Python\Python38\Include -D_GLIBCXX_USE_CXX11_ABI=0 /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -c C:\Users\alero\Desktop\AI\VToonify\model\stylegan\op\fused_bias_act.cpp /Fofused_bias_act.o
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\pybind11\detail/common.h(106): warning C4005: 'HAVE_SNPRINTF': macro redefinition
C:\Users\alero\AppData\Local\Programs\Python\Python38\Include\pyerrors.h(315): note: see previous definition of 'HAVE_SNPRINTF'
[2/3] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\TH -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -IC:\Users\alero\AppData\Local\Programs\Python\Python38\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 -c C:\Users\alero\Desktop\AI\VToonify\model\stylegan\op\fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
FAILED: fused_bias_act_kernel.cuda.o
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\TH -IC:\Users\alero\Desktop\AI\VToonify\venv\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -IC:\Users\alero\AppData\Local\Programs\Python\Python38\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 -c C:\Users\alero\Desktop\AI\VToonify\model\stylegan\op\fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
C:/Users/alero/Desktop/AI/VToonify/venv/lib/site-packages/torch/include\c10/util/ThreadLocalDebugInfo.h(12): warning: modifier is ignored on an enum specifier

C:/Users/alero/Desktop/AI/VToonify/venv/lib/site-packages/torch/include\ATen/core/boxing/impl/boxing.h(100): warning: integer conversion resulted in a change of sign

C:/Users/alero/Desktop/AI/VToonify/venv/lib/site-packages/torch/include\ATen/record_function.h(13): warning: modifier is ignored on an enum specifier

C:/Users/alero/Desktop/AI/VToonify/venv/lib/site-packages/torch/include\ATen/core/op_registration/op_whitelist.h(39): warning: integer conversion resulted in a change of sign

C:/Users/alero/Desktop/AI/VToonify/venv/lib/site-packages/torch/include\torch/csrc/jit/ir/ir.h(1347): error: member "torch::jit::ProfileOptionalOp::Kind" may not be initialized

1 error detected in the compilation of "C:/Users/alero/AppData/Local/Temp/tmpxft_00006c08_00000000-10_fused_bias_act_kernel.cpp1.ii".
fused_bias_act_kernel.cu
ninja: build stopped: subcommand failed.
williamyang1991 commented 1 year ago

maybe you can use a CPU compatible version of model.stylegan.op to avoid the use of ninja/fused on Windows It seems many people have problem with model.stylegan.op even on Linux and replacing it with this version will solve the problem.

https://github.com/williamyang1991/VToonify/tree/main/model/stylegan/op_cpu

vitacon commented 1 year ago

Here are my two incomplete cents... =)

conda env create --name vtoonify_env conda activate vtoonify_env conda install python=3.9 conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia -c conda-forge conda install libfaiss=1.7.1 -c conda-forge conda install _libgcc_mutex=0.1 ca-certificates=2022.2.1 certifi=2021.10.8 conda install faiss=1.7.1 m2-libedit libfaiss-avx2=1.7.1 conda install libffi=3.2.1 -c conda-forge conda install matplotlib-base=3.3.4 pillow=8.3.1 pip python-lmdb=1.2.1 setuptools=49.6.0 scikit-image=0.18.1 pip install cmake matplotlib ninja numpy opencv-python==4.5.3.56 scipy tqdm wget pip install "dlib-19.22.99-cp39-cp39-win_amd64.whl" (get it here: https://github.com/sachadee/Dlib)

I had to modify it a bit. These somewhat passed - sometimes with different versions.

conda create --name vtoon_env
conda activate vtoon_env
conda install python=3.9
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia -c conda-forge
conda install libfaiss=1.7.1 -c conda-forge
conda install _libgcc_mutex=0.1 ca-certificates=2022.2.1 certifi=2021.10.8
conda install faiss=1.7.1 m2-libedit libfaiss-avx2=1.7.1 -c conda-forge
conda install libffi=3.2.1 -c conda-forge
conda install matplotlib-base=3.3.4 
conda install python-lmdb=1.2.1
conda install setuptools
conda install pip
conda install pillow

pip install cmake matplotlib ninja numpy opencv-python==4.5.3.56 scipy tqdm wget 
pip install "dlib-19.22.99-cp39-cp39-win_amd64.whl"
       (get it here: https://github.com/sachadee/Dlib)

However, this one reports a long list of conflicts: conda install scikit-image

I ran the app anyway to see what exactly woud crash and I got this: "UserWarning: Error checking compiler version for cl"

I had already installed separate CL Tools from the latest Visual Studio, but I had to run the .bat (from Anaconda Prompt) to set paths.

"c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsx86_amd64.bat"

Then I noticed I had to manually download some model so I did it, ran the app again and...

Downloading: "https://download.pytorch.org/models/resnet18-5c106cde.pth" to C:\Users\Administrator/.cache\torch\hub\checkpoints\resnet18-5c106cde.pth
100%|██████████████████████████████████████████████████████████████████████████████| 44.7M/44.7M [01:29<00:00, 526kB/s]
Load models successfully!
Processing portrait.jpg with vtoonify_d
C:\Users\Administrator\VToonify\model\stylegan\op\conv2d_gradfix.py:88: UserWarning: conv2d_gradfix not supported on PyTorch 1.13.1. Falling back to torch.nn.functional.conv2d().
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\Administrator\VToonify\style_transfer.py", line 226, in <module>
    y_tilde = vtoonify(inputs, s_w.repeat(inputs.size(0), 1, 1), d_s = args.style_degree)
  File "C:\ProgramData\Anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\Administrator\VToonify\model\vtoonify.py", line 258, in forward
    out, m_E = self.fusion_out[fusion_index](out, f_E, d_s)
  File "C:\ProgramData\Anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\Administrator\VToonify\model\vtoonify.py", line 125, in forward
    out = torch.cat([f_G, abs(f_G-f_E)], dim=1)
RuntimeError: The size of tensor a (120) must match the size of tensor b (119) at non-singleton dimension 3

I suppose I should try other version than PyTorch 1.13.1...

williamyang1991 commented 1 year ago

@vitacon The warning of UserWarning: conv2d_gradfix not supported on PyTorch 1.13.1. Falling back to torch.nn.functional.conv2d(). is not a big problem. I can also run the code to produce the right results with this warning.

I think you successfully install the environment. I think the error RuntimeError: The size of tensor a (120) must match the size of tensor b (119) at non-singleton dimension 3 is not related to the environment, but your input size. You can try to make the width/height of portrait.jpg divisible by 8 or even 16 to clear the runtimeerror.

vitacon commented 1 year ago

Thanks @williamyang1991! I should have read your comment before I made a mess in my installed packages. =} It took me a while to make it running again and you were right - the problem was just the wrong resolution of the input.

The easiest solution was using "-- scale_image",

It was also necessary for another image of 1600 x 1600 pixels because otherwise it crashed:

OutOfMemoryError: CUDA out of memory. Tried to allocate 626.00 MiB (GPU 0; 8.00 GiB total capacity; 5.30 GiB already allocated; 0 bytes free; 6.81 GiB reserved in total by PyTorch)

I think it would be useful to enable the option "-- scale_image" by default or add a proper error message for this kind of situations. =}

mercantigo commented 1 year ago

@vitacon do you mind to share your env image with conda-pack? I've been trying for 4 days with no success. I've reproduced what you guys did but with no luck. This is what happens when I run python style_transfer.py --scale_image --content ./data/529.mp4 --video

warnings.warn(f'Error checking compiler version for {compiler}: {error}') Traceback (most recent call last): File "C:\Users\felip\VToonify\style_transfer.py", line 11, in <module> from model.vtoonify import VToonify File "C:\Users\felip\VToonify\model\vtoonify.py", line 5, in <module> from model.stylegan.model import ConvLayer, EqualLinear, Generator, ResBlock File "C:\Users\felip\VToonify\model\stylegan\model.py", line 11, in <module> from model.stylegan.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix File "C:\Users\felip\VToonify\model\stylegan\op\__init__.py", line 1, in <module> from .fused_act import FusedLeakyReLU, fused_leaky_relu File "C:\Users\felip\VToonify\model\stylegan\op\fused_act.py", line 11, in <module> fused = load( File "C:\Users\felip\anaconda3\envs\AVToonify_env\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load return _jit_compile( File "C:\Users\felip\anaconda3\envs\AVToonify_env\lib\site-packages\torch\utils\cpp_extension.py", line 1508, in _jit_compile _write_ninja_file_and_build_library( File "C:\Users\felip\anaconda3\envs\AVToonify_env\lib\site-packages\torch\utils\cpp_extension.py", line 1610, in _write_ninja_file_and_build_library _write_ninja_file_to_build_library( File "C:\Users\felip\anaconda3\envs\AVToonify_env\lib\site-packages\torch\utils\cpp_extension.py", line 2014, in _write_ninja_file_to_build_library cuda_flags = common_cflags + COMMON_NVCC_FLAGS + _get_cuda_arch_flags() File "C:\Users\felip\anaconda3\envs\AVToonify_env\lib\site-packages\torch\utils\cpp_extension.py", line 1780, in _get_cuda_arch_flags arch_list[-1] += '+PTX' IndexError: list index out of range

vitacon commented 1 year ago

@mercantigo I'm no expert at Python etc. but since it mentions compiler I suspect this error is related to CL Tools. https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170

I did not have Visual Studio on my lab computer so I had to download at least part of it.

I forgot some details but I hope it was this: https://aka.ms/vs/17/release/vs_BuildTools.exe

luoww1992 commented 1 year ago

@vitacon @hugosbnarciso can you share me your env and the vs env and GPU ? and i have installed Vs2019, but it is wrong when run code.

now my main pkgs is cuda11.3 torch1.12.1 ( i have try torch1.7 and 1.9 but it is wrong), run default cmd, it show me: fused_bias_act_kernel.cuda.o : error LNK2001: 无法解析的外部符号 "protected: virtual int64 cdecl std::basic_streambuf<char,struct std::char_traits >::xsgetn(char ,int64)" (?xsget n@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z) fused_bias_act.o : error LNK2001: 无法解析的外部符号 "protected: virtual int64 __cdecl std::basic_streambuf<char,struct std::char_traits >::xsputn(char const ,__int64)" (?xsputn@?$ba sic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z) fused_bias_act_kernel.cuda.o : error LNK2001: 无法解析的外部符号 "protected: virtual int64 cdecl std::basic_streambuf<char,struct std::char_traits >::xsputn(char const *,__int64)" ( ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z) fused.pyd : fatal error LNK1120: 67 个无法解析的外部命令 ninja: build stopped: subcommand failed.

how to do it ?

vitacon commented 1 year ago

@luoww1992 My environment is really messy after all my experiments and I think it includes many unnecessary things:

# packages in environment at C:\Users\ATC\.conda\envs\vtoon_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
blas                      1.0                         mkl  
blosc                     1.21.3               h6c2663c_0  
brotli                    1.0.9                h2bbff1b_7  
brotli-bin                1.0.9                h2bbff1b_7  
brotlipy                  0.7.0           py39h2bbff1b_1003  
bzip2                     1.0.8                he774522_0  
ca-certificates           2022.12.7            h5b45459_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1           py39h2bbff1b_3  
cfitsio                   3.470                h2bbff1b_7  
charls                    2.2.0                h6c2663c_0  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
cloudpickle               2.0.0              pyhd3eb1b0_0  
cmake                     3.25.2                   pypi_0    pypi
colorama                  0.4.6                    pypi_0    pypi
contourpy                 1.0.5            py39h59b6b97_0  
cryptography              38.0.4           py39h21b164f_0  
cuda                      11.7.1                        0    nvidia
cuda-cccl                 11.7.91                       0    nvidia
cuda-command-line-tools   11.7.1                        0    nvidia
cuda-compiler             11.7.1                        0    nvidia
cuda-cudart               11.7.99                       0    nvidia
cuda-cudart-dev           11.7.99                       0    nvidia
cuda-cuobjdump            11.7.91                       0    nvidia
cuda-cupti                11.7.101                      0    nvidia
cuda-cuxxfilt             11.7.91                       0    nvidia
cuda-demo-suite           12.0.140                      0    nvidia
cuda-documentation        12.0.140                      0    nvidia
cuda-libraries            11.7.1                        0    nvidia
cuda-libraries-dev        11.7.1                        0    nvidia
cuda-memcheck             11.8.86                       0    nvidia
cuda-nsight-compute       12.0.1                        0    nvidia
cuda-nvcc                 11.7.99                       0    nvidia
cuda-nvdisasm             12.0.140                      0    nvidia
cuda-nvml-dev             11.7.91                       0    nvidia
cuda-nvprof               12.0.146                      0    nvidia
cuda-nvprune              11.7.91                       0    nvidia
cuda-nvrtc                11.7.99                       0    nvidia
cuda-nvrtc-dev            11.7.99                       0    nvidia
cuda-nvtx                 11.7.91                       0    nvidia
cuda-nvvp                 12.0.146                      0    nvidia
cuda-runtime              11.7.1                        0    nvidia
cuda-sanitizer-api        12.0.140                      0    nvidia
cuda-toolkit              11.7.1                        0    nvidia
cuda-tools                11.7.1                        0    nvidia
cuda-visual-tools         11.7.1                        0    nvidia
cudatoolkit               11.3.1               h59b6b97_2  
cycler                    0.11.0             pyhd3eb1b0_0  
cytoolz                   0.12.0           py39h2bbff1b_0  
dask-core                 2022.7.0         py39haa95532_0  
faiss                     1.7.1           py39hd7114ca_1_cpu    conda-forge
fftw                      3.3.9                h2bbff1b_1  
flit-core                 3.6.0              pyhd3eb1b0_0  
fonttools                 4.25.0             pyhd3eb1b0_0  
freetype                  2.12.1               ha860e81_0  
fsspec                    2022.11.0        py39haa95532_0  
giflib                    5.2.1                h8cc25b3_1  
icc_rt                    2022.1.0             h6049295_2  
idna                      3.4              py39haa95532_0  
imagecodecs               2021.8.26        py39hc0a7faf_1  
imageio                   2.19.3           py39haa95532_0  
intel-openmp              2021.4.0          haa95532_3556  
jpeg                      9e                   h2bbff1b_0  
kiwisolver                1.4.4            py39hd77b12b_0  
lcms2                     2.12                 h83e58a3_0  
lerc                      3.0                  hd77b12b_0  
libaec                    1.0.4                h33f27b4_1  
libblas                   3.9.0           1_h8933c1f_netlib    conda-forge
libbrotlicommon           1.0.9                h2bbff1b_7  
libbrotlidec              1.0.9                h2bbff1b_7  
libbrotlienc              1.0.9                h2bbff1b_7  
libcublas                 11.10.3.66                    0    nvidia
libcublas-dev             11.10.3.66                    0    nvidia
libcufft                  10.7.2.124                    0    nvidia
libcufft-dev              10.7.2.124                    0    nvidia
libcurand                 10.3.1.124                    0    nvidia
libcurand-dev             10.3.1.124                    0    nvidia
libcusolver               11.4.0.1                      0    nvidia
libcusolver-dev           11.4.0.1                      0    nvidia
libcusparse               11.7.4.91                     0    nvidia
libcusparse-dev           11.7.4.91                     0    nvidia
libdeflate                1.8                  h2bbff1b_5  
libfaiss                  1.7.1            hf21947d_1_cpu    conda-forge
libfaiss-avx2             1.7.1            h1234567_1_cpu    conda-forge
libffi                    3.2.1             ha925a31_1007  
liblapack                 3.9.0           5_hd5c7e75_netlib    conda-forge
libnpp                    11.7.4.75                     0    nvidia
libnpp-dev                11.7.4.75                     0    nvidia
libnvjpeg                 11.8.0.2                      0    nvidia
libnvjpeg-dev             11.8.0.2                      0    nvidia
libpng                    1.6.37               h2a8f88b_0  
libtiff                   4.5.0                h6c2663c_1  
libuv                     1.40.0               he774522_0  
libwebp                   1.2.4                h2bbff1b_0  
libwebp-base              1.2.4                h2bbff1b_0  
libzopfli                 1.0.3                ha925a31_0  
locket                    1.0.0            py39haa95532_0  
lz4-c                     1.9.4                h2bbff1b_0  
m2-bash                   4.3.042                       5    conda-forge
m2-gcc-libs               5.3.0                         4    conda-forge
m2-libedit                3.1                    20150326    conda-forge
m2-msys2-runtime          2.5.0.17080.65c939c               3    conda-forge
m2-ncurses                6.0.20160220                  2    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
matplotlib-base           3.6.2            py39h1094b8e_0  
mkl                       2021.4.0           haa95532_640  
mkl-service               2.4.0            py39h2bbff1b_0  
mkl_fft                   1.3.1            py39h277e83a_0  
mkl_random                1.2.2            py39hf11a4ad_0  
msys2-conda-epoch         20160418                      1    conda-forge
munkres                   1.1.4                      py_0  
networkx                  2.8.4            py39haa95532_0  
ninja                     1.11.1                   pypi_0    pypi
nsight-compute            2022.4.1.6                    0    nvidia
numpy                     1.23.5           py39h3b20f71_0  
numpy-base                1.23.5           py39h4da318b_0  
opencv-python             4.5.3.56                 pypi_0    pypi
openjpeg                  2.4.0                h4fc8c34_0  
openssl                   1.1.1s               hcfcfb64_1    conda-forge
packaging                 22.0             py39haa95532_0  
partd                     1.2.0              pyhd3eb1b0_1  
pillow                    9.3.0            py39hd77b12b_2  
pip                       22.3.1           py39haa95532_0  
pycparser                 2.21               pyhd3eb1b0_0  
pyopenssl                 22.0.0             pyhd3eb1b0_0  
pyparsing                 3.0.9            py39haa95532_0  
pysocks                   1.7.1            py39haa95532_0  
python                    3.9.16               h6244533_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
python-lmdb               1.2.1            py39hd77b12b_1  
python_abi                3.9                      2_cp39    conda-forge
pytorch                   1.13.1          py3.9_cuda11.7_cudnn8_0    pytorch
pytorch-cuda              11.7                 h67b0de4_1    pytorch
pytorch-mutex             1.0                        cuda    pytorch
pywavelets                1.4.1            py39h2bbff1b_0  
pyyaml                    6.0              py39h2bbff1b_1  
requests                  2.28.1           py39haa95532_0  
scikit-image              0.19.3           py39hd77b12b_1  
scipy                     1.9.3            py39he11b74f_0  
setuptools                65.6.3           py39haa95532_0  
six                       1.16.0             pyhd3eb1b0_1  
snappy                    1.1.9                h6c2663c_0  
sqlite                    3.40.1               h2bbff1b_0  
tifffile                  2021.7.2           pyhd3eb1b0_2  
tk                        8.6.12               h2bbff1b_0  
toolz                     0.12.0           py39haa95532_0  
torchaudio                0.13.1                   pypi_0    pypi
torchvision               0.14.1                   pypi_0    pypi
tqdm                      4.64.1                   pypi_0    pypi
typing_extensions         4.4.0            py39haa95532_0  
tzdata                    2022g                h04d1e81_0  
ucrt                      10.0.20348.0         haa95532_0  
urllib3                   1.26.14          py39haa95532_0  
vc                        14.2                 h21ff451_1  
vs2015_runtime            14.34.31931         h4c5c07a_10    conda-forge
wget                      3.2                      pypi_0    pypi
wheel                     0.37.1             pyhd3eb1b0_0  
win_inet_pton             1.1.0            py39haa95532_0  
wincertstore              0.2              py39haa95532_2  
xz                        5.2.10               h8cc25b3_1  
yaml                      0.2.5                he774522_0  
zfp                       0.5.5                hd77b12b_6  
zlib                      1.2.13               h8cc25b3_0  
zstd                      1.5.2                h19a0ad4_0  

I used a test computer so I did not want to install the whole Visual Studio on it and I installed just "vs_BuildTools.exe" (and I think I chose "CPP" in its installer). Then I ran

"c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsx86_amd64.bat"

from Anaconda prompt to modify %PATH% and then it started to work.

(FYI I used RTX 3060 with 8 GB RAM.)

luoww1992 commented 1 year ago

@vitacon i have installed pkgs, then i run the vcvarsx86_amd64.bat, and you say: from Anaconda prompt to modify %PATH% , how ? is that add cl.exe to PATH ? when after install vs_BuildTools.exe, i find nothing changed in PATH.

luoww1992 commented 1 year ago

@vitacon , @williamyang1991 i try to add cl.exe in ...xxx/hostx64/x64 to PATH, after activate conda virtual env, when i run python style_transfer.py --scale_image , it use cuda11.3 (my real main env) to compile instead of cuda11.7 in conda env. why and how ?

luoww1992 commented 1 year ago

@vitacon , @williamyang1991 i am sucessful running the project in win10! Thank you for you help!

vitacon commented 1 year ago

@luoww1992 You are too quick. ;) Congratulation! =)

Just to explain it a bit more: As far as I know "vcvarsx86_amd64.bat" sets all the necessary variables. I usually create some batch file to activate the environment (init.cmd: conda activate ...) so I did not bother editing system path and I just added "call fullpath-to-vcvarsx86_amd64.bat" to my "init.cmd" file and I was done. That's just a matter of taste. =)

luoww1992 commented 1 year ago

@vitacon i tested to run the vcvarsx86_amd64.bat, but nothing changed in PATH, so i add it manually.

wrenni1 commented 2 months ago

??pip install cmake matplotlib ninja numpy opencv-python==4.5.3.56 scipy tqdm wget Traceback (most recent call last): File "D:\anaconda\envs\newpic\Scripts\pip-script.py", line 6, in from pip._internal.cli.main import main File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\cli\main.py", line 10, in from pip._internal.cli.autocompletion import autocomplete File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\cli\autocompletion.py", line 10, in from pip._internal.cli.main_parser import create_main_parser File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\cli\main_parser.py", line 9, in from pip._internal.build_env import get_runnable_pip File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\build_env.py", line 19, in from pip._internal.cli.spinners import open_spinner File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\cli\spinners.py", line 9, in from pip._internal.utils.logging import get_indentation File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\utils\logging.py", line 29, in from pip._internal.utils.misc import ensure_dir File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\utils\misc.py", line 44, in from pip._internal.locations import get_major_minor_version File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\locations__init.py", line 14, in from . import _sysconfig File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\locations_sysconfig.py", line 11, in from .base import change_root, get_major_minor_version, is_osx_framework File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\locations\base.py", line 9, in from pip._internal.utils import appdirs File "D:\anaconda\envs\newpic\lib\site-packages\pip_internal\utils\appdirs.py", line 13, in from pip._vendor import platformdirs as _appdirs File "D:\anaconda\envs\newpic\lib\site-packages\pip_vendor\platformdirs__init.py", line 46, in PlatformDirs = _set_platform_dir_class() #: Currently active platform File "D:\anaconda\envs\newpic\lib\site-packages\pip_vendor\platformdirs\init__.py", line 26, in _set_platform_dir_class from pip._vendor.platformdirs.windows import Windows as Result File "D:\anaconda\envs\newpic\lib\site-packages\pip_vendor\platformdirs\windows.py", line 4, in import ctypes File "D:\anaconda\envs\newpic\lib\ctypes\init__.py", line 8, in from _ctypes import Union, Structure, Array ImportError: DLL load failed while importing _ctypes: 找不到指定的模块。

wrenni1 commented 2 months ago

D:\xiangmuproject\VToonify-main>python style_transfer.py ./data/908.mp4 -ckpt ./checkpoint/vtoonify.pt Traceback (most recent call last): File "D:\xiangmuproject\VToonify-main\style_transfer.py", line 8, in from torchvision import transforms File "D:\anaconda\envs\vtvideo\lib\site-packages\torchvision__init.py", line 7, in from torchvision import datasets File "D:\anaconda\envs\vtvideo\lib\site-packages\torchvision\datasets\init__.py", line 1, in from .lsun import LSUN, LSUNClass File "D:\anaconda\envs\vtvideo\lib\site-packages\torchvision\datasets\lsun.py", line 2, in from PIL import Image File "D:\anaconda\envs\vtvideo\lib\site-packages\PIL\Image.py", line 114, in from . import _imaging as core ImportError: DLL load failed while importing _imaging: 找不到指定的模块。 how can i do

nitinmukesh commented 1 month ago

line 114, in from . import _imaging as core ImportError: DLL load failed while importing _imaging: 找不到指定的模

I got the same error

(vtoon) C:\usable\VToonify>python style_transfer.py --scale_image
Traceback (most recent call last):
  File "C:\usable\VToonify\style_transfer.py", line 8, in <module>
    from torchvision import transforms
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torchvision\__init__.py", line 10, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils  # usort:skip
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torchvision\datasets\__init__.py", line 1, in <module>
    from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torchvision\datasets\_optical_flow.py", line 10, in <module>
    from PIL import Image
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\PIL\Image.py", line 100, in <module>
    from . import _imaging as core
ImportError: DLL load failed while importing _imaging: The specified module could not be found.

Solution: pip install pillow==9.0.0

Next error

(vtoon) C:\usable\VToonify>python style_transfer.py --scale_image
C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torch\utils\cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
  warnings.warn(
Traceback (most recent call last):
  File "C:\usable\VToonify\style_transfer.py", line 11, in <module>
    from model.vtoonify import VToonify
  File "C:\usable\VToonify\model\vtoonify.py", line 5, in <module>
    from model.stylegan.model import ConvLayer, EqualLinear, Generator, ResBlock
  File "C:\usable\VToonify\model\stylegan\model.py", line 11, in <module>
    from model.stylegan.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix
  File "C:\usable\VToonify\model\stylegan\op\__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "C:\usable\VToonify\model\stylegan\op\fused_act.py", line 11, in <module>
    fused = load(
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torch\utils\cpp_extension.py", line 1312, in load
    return _jit_compile(
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torch\utils\cpp_extension.py", line 1747, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "C:\Users\nitin\miniconda3\envs\vtoon\lib\site-packages\torch\utils\cpp_extension.py", line 2141, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
ImportError: DLL load failed while importing fused: The specified module could not be found.