pupil-labs / apriltags

Python bindings for the apriltags3 library
https://pupil-apriltags.readthedocs.io/en/latest/index.html
Other
106 stars 29 forks source link

Getting around using Visual Studio to Setup Apriltags #51

Closed eichex closed 2 years ago

eichex commented 2 years ago

Hi,

trying to use Apriltags on Windows. Some circumstances prevent me from using Visual Studio. In the setup.py it is mentioned that the msvc must be used for compatibility. Is there a way to use the compiler without Visual Studio? How would i need to change the setup.py file to do so?

Greetings

eichex commented 2 years ago

Installed MSVC from Microsoft. Changed in setup.py line 21 from

cmake_args.append("-GVisual Studio 15 2017 Win64")

to

cmake_args.append("-GNMake Makefiles")

Set Package up with: pip install -e .[dev]

executed program that uses Apriltags, get the following error:

Traceback (most recent call last):
  File "//einstein/xchange-ew/cons/PythonScripts/MEASUREMENT/get_raw_data.py", line 317, in <module>
    camera = Camera()
  File "//einstein/xchange-ew/cons/PythonScripts/MEASUREMENT/get_raw_data.py", line 24, in __init__
    self.at_detector = Detector(families='tag36h11',
  File "C:\Users\jei\Documents\apriltags-main\src\pupil_apriltags\bindings.py", line 293, in __init__
    raise RuntimeError(
RuntimeError: Could not find clib with pattern *apriltag*.dll in any of (WindowsPath('C:/Users/jei/Documents/apriltags-main/src/pupil_apriltags/lib'), WindowsPath('C:/Users/jei/Documents/apriltags-main/src/pupil_apriltags/lib64'))

Seems like the Tags are not created. Running tox gives me the following results:

(AprilTag_1) C:\Users\jei\Documents\apriltags-main>tox
.package create: C:\Users\jei\Documents\apriltags-main\.tox\.package
.package installdeps: setuptools, wheel, scikit-build, cmake, ninja, pupil-pthreads-win;platform_system == "Windows"
ERROR: invocation failed (exit code 1), logfile: C:\Users\jei\Documents\apriltags-main\.tox\.package\log\.package-1.log
==================================================== log start =====================================================
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Requirement already satisfied: setuptools in c:\users\jei\documents\apriltags-main\.tox\.package\lib\site-packages (65.3.0)
Requirement already satisfied: wheel in c:\users\jei\documents\apriltags-main\.tox\.package\lib\site-packages (0.37.1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/scikit-build/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/scikit-build/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/scikit-build/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/scikit-build/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/scikit-build/
Could not fetch URL https://pypi.org/simple/scikit-build/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/scikit-build/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement scikit-build (from versions: none)
ERROR: No matching distribution found for scikit-build
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
WARNING: There was an error checking the latest version of pip.

===================================================== log end ======================================================
ERROR: could not install deps [setuptools, wheel, scikit-build, cmake, ninja, pupil-pthreads-win;platform_system == "Windows"]; v = InvocationError('\'C:\\Users\\jei\\Documents\\apriltags-main\\.tox\\.package\\Scripts\\python.EXE\' -m pip install setuptools wheel scikit-build cmake ninja \'pupil-pthreads-win;platform_system == "Windows"\'', 1)
Traceback (most recent call last):
  File "C:\Users\jei\.conda\envs\AprilTag_1\Lib\site-packages\tox\helper\build_requires.py", line 16, in <module>
    for_build_requires = backend.get_requires_for_build_sdist(None)
  File "C:\Users\jei\Documents\apriltags-main\.tox\.package\lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_sdist
    return self._get_build_requires(config_settings, requirements=[])
  File "C:\Users\jei\Documents\apriltags-main\.tox\.package\lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
    self.run_setup()
  File "C:\Users\jei\Documents\apriltags-main\.tox\.package\lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
    exec(code, locals())
  File "<string>", line 3, in <module>
ModuleNotFoundError: No module named 'skbuild'
ERROR: invocation failed (exit code 1), logfile: C:\Users\jei\Documents\apriltags-main\.tox\.package\log\.package-2.log
==================================================== log start =====================================================

===================================================== log end ======================================================
ERROR: FAIL could not package project - v = InvocationError("'C:\\Users\\jei\\Documents\\apriltags-main\\.tox\\.package\\Scripts\\python' 'C:\\Users\\jei\\.conda\\envs\\AprilTag_1\\Lib\\site-packages\\tox\\helper\\build_requires.py' setuptools.build_meta '' ''", 1)
eichex commented 2 years ago
  1. Download BuildTools from Microsoft: link
  2. Install MSVC with BuildTools (C++ for Desktop). Take care to install the v142 Component
  3. Get the Apriltags Git on your machine
  4. Open setup.py, change line 21 to cmake_args.append(''-GNMake Makefiles'')
  5. Go with Conda to the Apriltags folder and execute pip install .
  6. Should now be running. If the apriltag.dll is still not found, copy it from the _skbuild folder to the src folder.
papr commented 2 years ago

This issue seems to be resolved. Closing.