I've been using the python module apriltag
(found here https://pypi.org/project/apriltag/) on linux for a while, and need to move my system over to Windows. On my windows machine, I tried to install the apriltag pip package on python3.6:
python -m pip install apriltag
but the wheel failed to build, giving me a long error list in which I believe the key line is
Building Custom Rule C:/Users/xxxx/apriltag_3b8f424df9f543459d5bd3db09137d9f/core/CMakeLists.txt cl : Command line error D8021: invalid numeric argument '/Wsign-compare'```
Worried that maybe the PyPI package didn't work on windows(?) I looked at the project that it was based on, found here https://github.com/swatbotics/apriltag. Cloning into it and building it with Visual Studio, the first build fails with
Error D8021 invalid numeric argument '/Wsign-compare'
I've looked on here for /Wsign-compare
but have found no example of anyone even getting that error, let alone solving it. Let me know if there's a fix for it, or if this repo just isn't going to build on windows ever.
Thanks :)
EDIT: added entire python build log for context
python -m pip install apriltag
Collecting apriltag
Using cached apriltag-0.0.16.tar.gz (201 kB)
Building wheels for collected packages: apriltag
Building wheel for apriltag (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\xxxxxx\AppData\Local\Temp\2\pip-wheel-b7pu6nq2'
cwd: C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\
Complete output (75 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying python\apriltag.py -> build\lib.win-amd64-3.6
running build_ext
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PkgConfig: C:/msys64/usr/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/build/temp.win-amd64-3.6/Release
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,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\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,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\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 74, in <module>
py_modules=['apriltag']
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for apriltag
Running setup.py clean for apriltag
Failed to build apriltag
Installing collected packages: apriltag
Running setup.py install for apriltag ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xxxxxx\AppData\Local\Temp\2\pip-record-ryn6eco8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\Include\apriltag'
cwd: C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\
Complete output (77 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying python\apriltag.py -> build\lib.win-amd64-3.6
running build_ext
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PkgConfig: C:/msys64/usr/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/build/temp.win-amd64-3.6/Release
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,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\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,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\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 74, in <module>
py_modules=['apriltag']
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xxxxxx\AppData\Local\Temp\2\pip-record-ryn6eco8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\Include\apriltag' Check the logs for full command output.```
I got the same error with that PyPI
apriltag
library.Short answer: Don't use this poorly-maintained library. Use
pupil-apriltags
instead, which will work on Windows as well.More details
apriltag
[https://pypi.org/project/apriltag/#description] we are trying to install, viapip install apriltag
is apparently an "unofficial package" by a man named Bernd Winkler, last updated 7 December 2018.Matt says:
"Please note: I am not the maintainer of the pypi package listed at https://pypi.org/project/apriltag/ – GitHub issues filed here reporting problems with that package will be summarily closed. Sorry, I don't have time to support someone else's unofficial package."
So a better installation process would start from what Matt says at his GitHub repo:
Note: The
apriltag
does not appear to work on Windows:For me, on Windows, the "make" command was not available, so I followed this:
choco install make
Even so, the make command didn't do anything, though.
However, on Windows after running:
Gives the error:
AttributeError: module 'os' has no attribute 'uname'
, which is only available on UNIX.In searching I found other, better-maintained Python libraries for the AprilTag C bindings. In particular, this one: pupil_apriltags. And it works on Windows.