Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

[Windows 10] No module named 'resample2d_cuda' #50

Open
FekLeyrTarg opened this issue Aug 6, 2021 · 3 comments
Open

[Windows 10] No module named 'resample2d_cuda' #50

FekLeyrTarg opened this issue Aug 6, 2021 · 3 comments

Comments

@FekLeyrTarg
Copy link

First of all thank you for this fantastic program.
I'm confident it's going to be a game-changer.

I'm trying to use it on Windows 10 and I've managed to install the needed packages using Anaconda.
However, I'm getting this error message: No module named 'resample2d_cuda'.

Reading up different solutions I've found out that I need to go to "third_party\flownet2\networks\resample2d_package"
and enter:

python setup.py build
python setup.py install

(Source: NVIDIA/vid2vid#30 )

However, executing the first line gives me the following:

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4'
running build
running build_ext
C:\Users\Rafi\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
building 'resample2d_cuda' extension
creating H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8
creating H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8\Release
Emitting ninja build file H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\TH -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include" -IC:\Users\Rafi\anaconda3\include -IC:\Users\Rafi\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c "H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\resample2d_cuda.cc" /Fo"H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8\Release\resample2d_cuda.obj" -std=c++11 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=resample2d_cuda -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
FAILED: H:/Program Files/consistent_depth-master/third_party/flownet2/networks/resample2d_package/build/temp.win-amd64-3.8/Release/resample2d_cuda.obj
cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\TH -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include" -IC:\Users\Rafi\anaconda3\include -IC:\Users\Rafi\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c "H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\resample2d_cuda.cc" /Fo"H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8\Release\resample2d_cuda.obj" -std=c++11 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=resample2d_cuda -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
cl : Befehlszeile warning D9002 : Unbekannte Option "-std=c++11" wird ignoriert.
Hinweis: Einlesen der Datei: C:\Users\Rafi\anaconda3\lib\site-packages\torch\include\ATen/ATen.h
Hinweis: Einlesen der Datei:  C:\Users\Rafi\anaconda3\lib\site-packages\torch\include\c10/core/Allocator.h
C:\Users\Rafi\anaconda3\lib\site-packages\torch\include\c10/core/Allocator.h(3): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "stddef.h": No such file or directory
[2/2] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\nvcc  --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\TH -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include" -IC:\Users\Rafi\anaconda3\include -IC:\Users\Rafi\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c "H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\resample2d_kernel.cu" -o "H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8\Release\resample2d_kernel.obj" -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_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=resample2d_cuda -D_GLIBCXX_USE_CXX11_ABI=0
FAILED: H:/Program Files/consistent_depth-master/third_party/flownet2/networks/resample2d_package/build/temp.win-amd64-3.8/Release/resample2d_kernel.obj
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\nvcc  --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\TH -IC:\Users\Rafi\anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include" -IC:\Users\Rafi\anaconda3\include -IC:\Users\Rafi\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c "H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\resample2d_kernel.cu" -o "H:\Program Files\consistent_depth-master\third_party\flownet2\networks\resample2d_package\build\temp.win-amd64-3.8\Release\resample2d_kernel.obj" -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_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=resample2d_cuda -D_GLIBCXX_USE_CXX11_ABI=0
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/include\crtdefs.h(10): fatal error C1083: Datei (Include) kann nicht ge÷ffnet werden: "corecrt.h": No such file or directory
nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
resample2d_kernel.cu
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "C:\Users\Rafi\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1667, in _run_ninja_build
    subprocess.run(
  File "C:\Users\Rafi\anaconda3\lib\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 "setup.py", line 19, in <module>
    setup(
  File "C:\Users\Rafi\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\Rafi\anaconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Rafi\anaconda3\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Rafi\anaconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Rafi\anaconda3\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\Rafi\anaconda3\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Rafi\anaconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Rafi\anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
    _build_ext.run(self)
  File "C:\Users\Rafi\anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Users\Rafi\anaconda3\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\Users\Rafi\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 708, in build_extensions
    build_ext.build_extensions(self)
  File "C:\Users\Rafi\anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "C:\Users\Rafi\anaconda3\lib\distutils\command\build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "C:\Users\Rafi\anaconda3\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\Users\Rafi\anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 196, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\Users\Rafi\anaconda3\lib\distutils\command\build_ext.py", line 528, in build_extension
    objects = self.compiler.compile(sources,
  File "C:\Users\Rafi\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 681, in win_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "C:\Users\Rafi\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1354, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "C:\Users\Rafi\anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1683, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

Any idea what I'm doing wrong?

I must say I'm not a programmer and I'm barely familiar with the Python/Linux stuff.
So any help is very much apprechiated.

@AjayNallani
Copy link

under "third_party\flownet2\networks\resample2d_package", there will be a setup.py file. Please edit line 8 to reflect the following changes 'cxx_args = ['-std=c++14']'. curreny repo is set to c++11 standard and is having compiling issues. Replace it with C++14 and that should do the trick.
After that run 'python setup.py install' and you should be able to find resample2d_cuda.

@FekLeyrTarg
Copy link
Author

FekLeyrTarg commented Aug 11, 2021

under "third_party\flownet2\networks\resample2d_package", there will be a setup.py file. Please edit line 8 to reflect the following changes 'cxx_args = ['-std=c++14']'. curreny repo is set to c++11 standard and is having compiling issues. Replace it with C++14 and that should do the trick.
After that run 'python setup.py install' and you should be able to find resample2d_cuda.

Still no luck I'm afraid as I'm getting the same error despite the change.

Edit 1: Is it possible that Torch 1.4.0 must be installed and no higher versions?

Edit 2: Ok, I've managed to install Torch 1.4.0 via Conda. On Win10, using Pip doesn't work for some reason.

Now I'm getting a new error when trying to execute python setup.py build:

setup.py build
running build
running build_ext
C:\Users\Rafi\anaconda3\envs\consistent_depth\lib\site-packages\torch\utils\cpp_extension.py:209: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden
  warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
building 'resample2d_cuda' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Rafi\anaconda3\envs\consistent_depth\lib\site-packages\torch\include -IC:\Users\Rafi\anaconda3\envs\consistent_depth\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Rafi\anaconda3\envs\consistent_depth\lib\site-packages\torch\include\TH -IC:\Users\Rafi\anaconda3\envs\consistent_depth\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include" -IC:\Users\Rafi\anaconda3\envs\consistent_depth\include -IC:\Users\Rafi\anaconda3\envs\consistent_depth\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpresample2d_cuda.cc /Fobuild\temp.win-amd64-3.6\Release\resample2d_cuda.obj /MD /wd4819 /EHsc -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=resample2d_cuda -D_GLIBCXX_USE_CXX11_ABI=0
cl : Befehlszeile warning D9002 : Unbekannte Option "-std=c++14" wird ignoriert.
resample2d_cuda.cc
C:\Users\Rafi\anaconda3\envs\consistent_depth\lib\site-packages\torch\include\c10/core/Allocator.h(3): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "stddef.h": No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

@fisakhan
Copy link

fisakhan commented Oct 28, 2021

By changing c++11 ti c++14 and running

python main.py --video_file data/videos/ayush.mp4 --path results/ayush \
--camera_params "1671.770118, 540, 960" --camera_model "SIMPLE_PINHOLE" \
--make_video

i get the following error:

Traceback (most recent call last):
File "/home/Projects/consistent_depth/consistent_depth/third_party/flownet2/models.py", line 12, in
from networks.resample2d_package.resample2d import Resample2d
ModuleNotFoundError: No module named 'networks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 5, in
from process import DatasetProcessor
File "/home/Projects/consistent_depth/consistent_depth/process.py", line 10, in
from flow import Flow
File "/home/Projects/consistent_depth/consistent_depth/flow.py", line 15, in
import optical_flow_flownet2_homography
File "/home/Projects/consistent_depth/consistent_depth/optical_flow_flownet2_homography.py", line 11, in
from third_party.flownet2.models import FlowNet2
File "/home/Projects/consistent_depth/consistent_depth/third_party/flownet2/models.py", line 23, in
from .networks.channelnorm_package.channelnorm import ChannelNorm
File "/home/Projects/consistent_depth/consistent_depth/third_party/flownet2/networks/channelnorm_package/channelnorm.py", line 5, in
import channelnorm_cuda
ModuleNotFoundError: No module named 'channelnorm_cuda'

my CUDA Version:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Wed_Jul_22_19:09:09_PDT_2020
Cuda compilation tools, release 11.0, V11.0.221
Build cuda_11.0_bu.TC445_37.28845127_0

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

No branches or pull requests

3 participants