MVIG-SJTU/AlphaPose

How to install Alphapose on windows ?

wwdok opened this issue · 8 comments

wwdok commented

Hi, i am following INSTALL doc, but Windows has no command line sudo apt-get, so how to install libyaml-dev on windows?

Hi, please see line 5 at https://github.com/MVIG-SJTU/AlphaPose/blob/master/docs/INSTALL.md#requirements, already mentioned in readme.

wwdok commented

@Fang-Haoshu Well, i skip installing libyaml-dev , just move on and run python setup.py build develop, then it reports error:

D:\Repo\PoseEstimation\AlphaPose>python setup.py build develop
C:\ProgramData\Anaconda3\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
running build
running build_py
copying alphapose\version.py -> build\lib\alphapose
running develop
running egg_info
writing alphapose.egg-info\PKG-INFO
writing dependency_links to alphapose.egg-info\dependency_links.txt
writing requirements to alphapose.egg-info\requires.txt
writing top-level names to alphapose.egg-info\top_level.txt
reading manifest file 'alphapose.egg-info\SOURCES.txt'
writing manifest file 'alphapose.egg-info\SOURCES.txt'
C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py:335: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
running build_ext
Creating c:\programdata\anaconda3\lib\site-packages\alphapose.egg-link (link to .)
alphapose 0.3.0+ad03490 is already the active version in easy-install.pth

Installed d:\repo\poseestimation\alphapose
Processing dependencies for alphapose==0.3.0+ad03490
Searching for scipy==1.1.0
Reading https://pypi.tuna.tsinghua.edu.cn/simple/scipy/
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/07/76/7e844757b9f3bf5ab9f951ccd3e4a8eed91ab8720b0aac8c2adcc2fdae9f/scipy-1.1.0.tar.gz#sha256=878352408424dffaa695ffedf2f9f92844e116686923ed9aa8626fc30d32cfd1
Best match: scipy 1.1.0
Processing scipy-1.1.0.tar.gz
Writing C:\Users\wadew\AppData\Local\Temp\easy_install-fniea1ds\scipy-1.1.0\setup.cfg
Running scipy-1.1.0\setup.py -q bdist_egg --dist-dir C:\Users\wadew\AppData\Local\Temp\easy_install-fniea1ds\scipy-1.1.0\egg-dist-tmp-otbdola5
C:\Users\wadew\AppData\Local\Temp\easy_install-fniea1ds\scipy-1.1.0\setup.py:375: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command, proceeding with "
Could not locate executable g77
Could not locate executable f77
Could not locate executable ifort
Could not locate executable ifl
Could not locate executable f90
Could not locate executable DF
Could not locate executable efl
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable g95
Could not locate executable efort
Could not locate executable efc
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1730: UserWarning:
    Lapack (http://www.netlib.org/lapack/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [lapack]) or by setting
    the LAPACK environment variable.
  return getattr(self, '_calc_info_{}'.format(name))()
C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1730: UserWarning:
    Lapack (http://www.netlib.org/lapack/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    the LAPACK_SRC environment variable.
  return getattr(self, '_calc_info_{}'.format(name))()
Running from scipy source directory.
error: no lapack/blas resources found

I actually have installed blas and lapack by anaconda:
image
image
image

wwdok commented

Fine, i modify the scipy==1.1.0 to scipy==1.4.1 in setup.py, it installed successfully, but when i run python scripts/demo_inference.py --cfg configs/coco/resnet/256x192_res50_lr1e-3_1x.yaml --checkpoint fast_res50_256x192.pth --outdir examples/res --vis --webcam 0 , another error occurs:
ImportError: cannot import name 'deform_conv_cuda' from partially initialized module 'alphapose.models.layers.dcn' (most likely due to a circular import) (d:\repo\poseestimation\alphapose\alphapose\models\layers\dcn_init_.py)

Then i saw this issue, and comment out if statement, run python setup.py build develop again, it reports error:error : detector\nms\src/nms_cuda.cpp(9): error C3861: “AT_CHECK”: identifier not found error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
===============update===============
above error disappear, another error comes out after i run python setup.py build develop:
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1516, in _run_ninja_build
subprocess.run(
File "C:\ProgramData\Anaconda3\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 "setup.py", line 186, in <module>
    setup(
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
    _build_ext.run(self)
  File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 653, in build_extensions
    build_ext.build_extensions(self)
  File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 196, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 528, in build_extension
    objects = self.compiler.compile(sources,
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 626, in win_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1538, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

I got similar error:

D:\Github\AlphaPose\detector\nms\src\nms_cuda.cpp(9): error C3861: “AT_CHECK”: 找不到标识符
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\torch\utils\cpp_extension.py", line 1533, in _run_ninja_build
    subprocess.run(
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '8']' 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 186, in <module>
    setup(
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\setuptools\__init__.py", line 163, in setup
    return distutils.core.setup(**attrs)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\setuptools\command\build_ext.py", line 87, in run
    _build_ext.run(self)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\torch\utils\cpp_extension.py", line 670, in build_extensions
    build_ext.build_extensions(self)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\command\build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\setuptools\command\build_ext.py", line 208, in build_extension
    _build_ext.build_extension(self, ext)
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\distutils\command\build_ext.py", line 528, in build_extension
    objects = self.compiler.compile(sources,
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\torch\utils\cpp_extension.py", line 643, in win_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\torch\utils\cpp_extension.py", line 1250, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "D:\Applications\WPy64-3850\python-3.8.5.amd64\lib\site-packages\torch\utils\cpp_extension.py", line 1555, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

Similar errors here!!!

Similar errors here!!! also windows!

1.4.1

@Fang-Haoshu Well, i skip installing libyaml-dev , just move on and run python setup.py build develop, then it reports error:

D:\Repo\PoseEstimation\AlphaPose>python setup.py build develop
C:\ProgramData\Anaconda3\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
running build
running build_py
copying alphapose\version.py -> build\lib\alphapose
running develop
running egg_info
writing alphapose.egg-info\PKG-INFO
writing dependency_links to alphapose.egg-info\dependency_links.txt
writing requirements to alphapose.egg-info\requires.txt
writing top-level names to alphapose.egg-info\top_level.txt
reading manifest file 'alphapose.egg-info\SOURCES.txt'
writing manifest file 'alphapose.egg-info\SOURCES.txt'
C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py:335: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
running build_ext
Creating c:\programdata\anaconda3\lib\site-packages\alphapose.egg-link (link to .)
alphapose 0.3.0+ad03490 is already the active version in easy-install.pth

Installed d:\repo\poseestimation\alphapose
Processing dependencies for alphapose==0.3.0+ad03490
Searching for scipy==1.1.0
Reading https://pypi.tuna.tsinghua.edu.cn/simple/scipy/
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/07/76/7e844757b9f3bf5ab9f951ccd3e4a8eed91ab8720b0aac8c2adcc2fdae9f/scipy-1.1.0.tar.gz#sha256=878352408424dffaa695ffedf2f9f92844e116686923ed9aa8626fc30d32cfd1
Best match: scipy 1.1.0
Processing scipy-1.1.0.tar.gz
Writing C:\Users\wadew\AppData\Local\Temp\easy_install-fniea1ds\scipy-1.1.0\setup.cfg
Running scipy-1.1.0\setup.py -q bdist_egg --dist-dir C:\Users\wadew\AppData\Local\Temp\easy_install-fniea1ds\scipy-1.1.0\egg-dist-tmp-otbdola5
C:\Users\wadew\AppData\Local\Temp\easy_install-fniea1ds\scipy-1.1.0\setup.py:375: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command, proceeding with "
Could not locate executable g77
Could not locate executable f77
Could not locate executable ifort
Could not locate executable ifl
Could not locate executable f90
Could not locate executable DF
Could not locate executable efl
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable g95
Could not locate executable efort
Could not locate executable efc
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1730: UserWarning:
    Lapack (http://www.netlib.org/lapack/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [lapack]) or by setting
    the LAPACK environment variable.
  return getattr(self, '_calc_info_{}'.format(name))()
C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1730: UserWarning:
    Lapack (http://www.netlib.org/lapack/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    the LAPACK_SRC environment variable.
  return getattr(self, '_calc_info_{}'.format(name))()
Running from scipy source directory.
error: no lapack/blas resources found

I actually have installed blas and lapack by anaconda: image image image

I have the same error but can't fix it by changing the setup.py.

For error subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1 on Windows, which means execute ninja -v error, go to file site-package/torch/utils/cpp_extension.py, change command ['ninja', '-v'] into ['ninja', '--version'], for torch1.8.0, this lies on line 1631