facebookresearch / DeltaCNN

DeltaCNN End-to-End CNN Inference of Sparse Frame Differences in Videos
Other
60 stars 5 forks source link

build failure on windows #10

Closed yxtj closed 1 year ago

yxtj commented 1 year ago

I try to install DeltaCNN on windows 10. I use Anaconda, python 3.9, pytorch 1.13, cuda 11.7, and vs 2022.

On the first try, I get the following error message:

running install
F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing src\torchdeltacnn.egg-info\PKG-INFO
writing dependency_links to src\torchdeltacnn.egg-info\dependency_links.txt
writing top-level names to src\torchdeltacnn.egg-info\top_level.txt
reading manifest file 'src\torchdeltacnn.egg-info\SOURCES.txt'
adding license file 'LICENSE.txt'
writing manifest file 'src\torchdeltacnn.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build\lib.win-amd64-cpython-39
creating build\lib.win-amd64-cpython-39\deltacnn
copying src\deltacnn\cuda_kernels.py -> build\lib.win-amd64-cpython-39\deltacnn
copying src\deltacnn\filter_conversion.py -> build\lib.win-amd64-cpython-39\deltacnn
copying src\deltacnn\logging_layers.py -> build\lib.win-amd64-cpython-39\deltacnn
copying src\deltacnn\sparse_layers.py -> build\lib.win-amd64-cpython-39\deltacnn
copying src\deltacnn\utils.py -> build\lib.win-amd64-cpython-39\deltacnn
copying src\deltacnn\__init__.py -> build\lib.win-amd64-cpython-39\deltacnn
running build_ext
Traceback (most recent call last):
  File "E:\Code\ppvas\reference\DeltaCNN-main\setup.py", line 44, in <module>
    setup(
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
    return run_commands(dist)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
    dist.run_commands()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\dist.py", line 1208, in run_command
    super().run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install.py", line 74, in run
    self.do_egg_install()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install.py", line 123, in do_egg_install
    self.run_command('bdist_egg')
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\dist.py", line 1208, in run_command
    super().run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\bdist_egg.py", line 165, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\bdist_egg.py", line 151, in call_command
    self.run_command(cmdname)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\dist.py", line 1208, in run_command
    super().run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\command\install_lib.py", line 112, in build
    self.run_command('build_ext')
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\dist.py", line 1208, in run_command
    super().run_command(command)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
    _build_ext.run(self)
  File "F:\anaconda3\envs\privacy\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
    self.build_extensions()
  File "F:\anaconda3\envs\privacy\lib\site-packages\torch\utils\cpp_extension.py", line 485, in build_extensions
    compiler_name, compiler_version = self._check_abi()
  File "F:\anaconda3\envs\privacy\lib\site-packages\torch\utils\cpp_extension.py", line 875, in _check_abi
    raise UserWarning(msg)
UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set `DISTUTILS_USE_SDK=1` and try again.

Then, I run the command "set DISTUTILS_USE_SDK=1", and give it a second try. I get the following error message:

running install
F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing src\torchdeltacnn.egg-info\PKG-INFO
writing dependency_links to src\torchdeltacnn.egg-info\dependency_links.txt
writing top-level names to src\torchdeltacnn.egg-info\top_level.txt
reading manifest file 'src\torchdeltacnn.egg-info\SOURCES.txt'
adding license file 'LICENSE.txt'
writing manifest file 'src\torchdeltacnn.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
error: [WinError 2] The system cannot find the file specified

It does not specify which file cannot be found.

On Linux, it works. I have no idea how to solve it.

dabeschte commented 1 year ago

Hm, I am sorry, but it did not run into this problem yet. My first guess is that PyTorch extension building does not work with Visual Studio 2022 yet. Can you try it again with VS 2019? My local installation is Windows 10, VS 2019, CUDA 11.3 (but 11.6 & 11.7 should also work), Python 3.9 (also Anaconda) and PyTorch 1.11 and it builds without a problem. I guess the only thing you need to change is the visual studio version (and thereby the entire build chain).

yxtj commented 1 year ago

Hm, I am sorry, but it did not run into this problem yet. My first guess is that PyTorch extension building does not work with Visual Studio 2022 yet. Can you try it again with VS 2019? My local installation is Windows 10, VS 2019, CUDA 11.3 (but 11.6 & 11.7 should also work), Python 3.9 (also Anaconda) and PyTorch 1.11 and it builds without a problem. I guess the only thing you need to change is the visual studio version (and thereby the entire build chain).

Thanks for your suggestion. I tried with VS 2019 (build 14.29.30133) and a new conda environment. The problem remains.

Here is the compiler message by running "cl.exe":

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30148 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

Here is the new error message:

running install
F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
F:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing src\torchdeltacnn.egg-info\PKG-INFO
writing dependency_links to src\torchdeltacnn.egg-info\dependency_links.txt
writing top-level names to src\torchdeltacnn.egg-info\top_level.txt
reading manifest file 'src\torchdeltacnn.egg-info\SOURCES.txt'
adding license file 'LICENSE.txt'
writing manifest file 'src\torchdeltacnn.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
error: [WinError 2] The system cannot find the file specified
dabeschte commented 1 year ago

That is unfortunate. But I cannot really help you here. This problem is unrelated to DeltaCNN and probably has something to do with either python, pytorch, conda or, most likely, the visual studio build environment. Please search the error online, there are many suggested solutions for this issue. But I can't tell which one would work for you

yxtj commented 1 year ago

That is unfortunate. But I cannot really help you here. This problem is unrelated to DeltaCNN and probably has something to do with either python, pytorch, conda or, most likely, the visual studio build environment. Please search the error online, there are many suggested solutions for this issue. But I can't tell which one would work for you

OK. I will try to figure it out. Thank you any well. BTY: are you going to update from "python setup.py" to "pip install"? I know pip handles many bothering install issues.

dabeschte commented 1 year ago

Have you tried running pip install? I think it should work

yxtj commented 1 year ago

I tried, but I got similar errors and warning. pip complains about setuptools.

(base) E:\Code\DeltaCNN-main>pip install .
Processing e:\code\deltacnn-main
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: torchdeltacnn
  Building wheel for torchdeltacnn (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext
      error: [WinError 2] The system cannot find the file specified
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for torchdeltacnn
  Running setup.py clean for torchdeltacnn
Failed to build torchdeltacnn
Installing collected packages: torchdeltacnn
  Running setup.py install for torchdeltacnn ... error
  error: subprocess-exited-with-error

  × Running setup.py install for torchdeltacnn did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      f:\anaconda3\envs\privacy\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\deltacnn
      copying src\deltacnn\cuda_kernels.py -> build\lib.win-amd64-cpython-39\deltacnn
      copying src\deltacnn\filter_conversion.py -> build\lib.win-amd64-cpython-39\deltacnn
      copying src\deltacnn\logging_layers.py -> build\lib.win-amd64-cpython-39\deltacnn
      copying src\deltacnn\sparse_layers.py -> build\lib.win-amd64-cpython-39\deltacnn
      copying src\deltacnn\utils.py -> build\lib.win-amd64-cpython-39\deltacnn
      copying src\deltacnn\__init__.py -> build\lib.win-amd64-cpython-39\deltacnn
      running build_ext
      error: [WinError 2] The system cannot find the file specified
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> torchdeltacnn

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
dabeschte commented 1 year ago

Ok, I now tried on my other PC which has a very similar environment as you. conda 22.11.1, python 3.9.16, pytorch 1.13.1, cuda 11.7, visual studio 2022. and it does build right away.

There is some problem with your environment. Maybe some paths are missing or the C++ build tools. I don't know. Did you try if installing other PyTorch extensions works? Like tiny-cuda-nn or NerfAcc (building from source) for example?

Anyways, this does not look like a problem with DeltaCNN. It would still be great for others if you could post your solution once you find it.

dabeschte commented 1 year ago

Hey! Did you find a solution?

yxtj commented 1 year ago

Hey! Did you find a solution? I have not. I plan to build up a clean environment for it.