Hey! So I’m trying to install an AprilTags library to work with AprilTag detection in Python, the package in question can be found at apriltag · PyPI
The library itself is a C extension. The publisher of the package did not include any wheels, and left up only the source dist. Therefore, installing requires the C toolchain to be installed which (at least for me), has been a pretty cumbersome process on Windows.
After searching for answers beforehand, I did come a cross this post, although at least to my understanding, there wasn’t any solution that came up on Windows.
I have Visual Studio Build Tools 2019 installed, and the problem described in the error seems to be something related to CMake (I have version 3.28.2)
Error here
```python3 Collecting apriltag Using cached apriltag-0.0.16.tar.gz (201 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: apriltag Building wheel for apriltag (setup.py) ... error error: subprocess-exited-with-error× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [105 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
copying python\apriltag.py → build\lib.win-amd64-cpython-310
running build_ext
C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\setup.py:30: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
cmake_version = LooseVersion(re.search(r’version\s*([\d.]+)', out.decode()).group(1))
– Building for: Visual Studio 16 2019
CMake Warning (dev) at CMakeLists.txt:1 (project):
cmake_minimum_required() should be called prior to this top-level project()
call. Please see the cmake-commands(7) manual for usage documentation of
both commands.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.29.30153.0
-- The CXX compiler identification is MSVC 19.29.30153.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Found PkgConfig: D:/pkg-config/bin/pkg-config.exe (found version "0.26")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done (14.0s)
-- Generating done (0.1s)
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/GDKID/AppData/Local/Temp/pip-install-k4g9iceh/apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96/build/temp.win-amd64-cpython-310/Release
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\build\temp.win-amd64-cpython-310\Release\ZERO_CHECK.vcxproj]
1>Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\build\temp.win-amd64-cpython-310\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/GDKID/AppData/Local/Temp/pip-install-k4g9iceh/apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96/core/CMakeLists.txt
cl : command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\build\temp.win-amd64-cpython-310\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\setup.py", line 62, in <module>
setup(
File "D:\random-shit\venv\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
return run_commands(dist)
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
dist.run_commands()
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
self.run_command(cmd)
File "D:\random-shit\venv\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "D:\random-shit\venv\lib\site-packages\wheel\bdist_wheel.py", line 368, in run
self.run_command("build")
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
self.distribution.run_command(command)
File "D:\random-shit\venv\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "D:\random-shit\venv\lib\site-packages\setuptools\command\build.py", line 24, in run
super().run()
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
self.run_command(cmd_name)
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
self.distribution.run_command(command)
File "D:\random-shit\venv\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "D:\random-shit\venv\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\GDKID\AppData\Local\Temp\pip-install-k4g9iceh\apriltag_fcdb4ef49a0a48cb9c409acf6ba86f96\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "D:\Python\lib\subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for apriltag
Running setup.py clean for apriltag
Failed to build apriltag
ERROR: Could not build wheels for apriltag, which is required to install pyproject.toml-based projects
</details>
Any help is appreciated. Thanks!