iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐡

Building OpenPose on Windows

に公開
2025/11/10

Overview

When implementing a Python program that uses OpenPose on Windows, you must build OpenPose from scratch to use its Python module. However, after struggling with the build process, it ended up not working.

Environment

  • Windows 11 x64
  • Python 3.7.9 (installation steps omitted)
  • Git 2.42.0.windows.2 (installation steps omitted)
  • CUDA 13.0 (using CUDA for GPU processing)
  • cuDNN 9.14.0
  • CMake 3.31.9
  • Visual Studio Community 2022
  • MSVC v142 - VS 2019 C++
  • PyBind 3.0.1

Preparation

0. Install Python and Git

Omitted

1. Install CMake

The build requires a version of CMake lower than v3.5. Search Google for "CMake Download", navigate to Older Releases, or use this link to go to the download page for older CMake versions. If downloading from GitHub, expand Assets, select cmake-3.xx.x-windows-x86_64.msi, and download. Run the downloaded file and install. Default settings are fine.

What is CMake?

A powerful and comprehensive solution for managing the software build process. Specifically, it is a tool that automatically generates build systems for compiling C++ and other software. It facilitates cross-platform development by automatically generating build scripts (Makefiles, Xcode project files, etc.) for each environment from platform-independent configuration files (CMakeLists.txt).

2. Install Visual Studio and Required Workloads

Use this link to download Visual Studio Community 2022. On the workload selection screen, check "Desktop development with C++". Also, from the "Individual components" tab, search for "v142", then check the following three items: "C++ v14.29(16.11) ATL (x86 and x64) for v142 build tools", "C++ v14.29(16.11) MFC (x86 and x64) for v142 build tools", and "MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.29-16.11)". Then install.

3. Install CUDA

Use this link to go to the download page. Select the appropriate platform and get the CUDA Toolkit Installer. Once the installer is launched, select the "Express" installation option and install the latest version of CUDA.

4. Install cuDNN

Use this link to go to the download page. Select the appropriate platform and get the Base Installer. Launch the installer, select the "Express" installation option, and install the latest version of cuDNN. Once the installation is complete, restart your PC just to be safe.

5. Clone the Project

Use the following command to clone the OpenPose source code:

git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git

Navigate to the openpose directory and install the submodules:

cd openpose
git submodule update --init --recursive --remote

6. Install PyBind

Search Google for "PyBind" or use this link to go to the download page. Click on Source code (zip) to download. Extract the downloaded file and copy all contents (files and folders at the level containing README) to openpose/3rdparty/pybind11.

7. Install Caffe Models

Caffe models have been uploaded to the web by contributors. Download the models from this page. Downloading the Zip requires a Kaggle account. Extract the downloaded Zip and copy the files into the project.

File Name Copy Destination
pose_iter_584000.caffemodel openpose/models/pose/body_25
pose_iter_440000.caffemodel openpose/models/pose/coco
pose_iter_160000.caffemodel openpose/models/pose/mpi
pose_iter_116000.caffemodel openpose/models/face
pose_iter_102000.caffemodel openpose/models/hand

Configure and Generate

Create a build directory directly under the openpose directory, navigate into it, and launch the CMake GUI.

mkdir ./build
cd ./build
cmake-gui

In the CMake GUI, set the source code path to the openpose directory.

Press Add Entry, then check the BUILD_PYTHON Boolean.

Press Configure, select Visual Studio 16 2019 and x64, then press Finish.

If it stops halfway, press Stop and retry the Configure.

Once completed, press Generate.

Build

Press Open Project in the CMake GUI.

In the opened Visual Studio, change the solution configuration to Release and press Build.

Results

It fails. Changing the Python version does not work either. No matter what I try, I get compilation errors.

Using Visual Studio 2017 might work, but currently it cannot be installed. Apparently, it is possible to install an older version of the compiler on Visual Studio 2022, but I was not able to figure it out.

References

https://qiita.com/TrashBoxx/items/2e884998cd1193f73e2f

https://black-kitten092.hatenablog.com/entry/2020/08/04/173615

https://miyashinblog.com/openpose/

Discussion