Last active
May 26, 2024 13:09
-
-
Save ore-/d3e52c2bf83f6dc74dce906eda20debe to your computer and use it in GitHub Desktop.
compiling dlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original intention was to install dlib dep for https://github.com/cubiq/ComfyUI_FaceAnalysis. Even though both cmake and MSVC 14 with VS 2022 build tool (17.9.7) were installed, when doign pip install dlib under ComfyUI_FaceAnalysis venv, it complained that cmake was not available. | |
So tried to build it from latest dlib repo. Took such a long time debugging the process: | |
- initially build failed with ValueError: path 'dlib/CMakeLists.txt/' cannot end with '/'. Found https://github.com/davisking/dlib/issues/2668 which led to https://github.com/davisking/dlib/issues/2480#issuecomment-1003647257. Apparently the build needs to be in the same drive as where Python is located (I had it in C:), even though the build was initiated from a venv (in D:). | |
- then the build couldn't locate cudnn, as cmake needs these cmake specific paths to point to the cudnn directories - https://stackoverflow.com/questions/78276120/dlib-fails-to-install-with-cuda-says-i-am-missing-cudnn | |
- build still failed as cuda wasn't compatible with VS 2022 v17.10 (https://stackoverflow.com/questions/78515942/cuda-compatibility-with-visual-studio-2022-version-17-10). downgraded the build tools to v17.9.7 by following steps and using specific vs installers for the build tool: https://wiki.python.org/moin/WindowsCompilers, https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#updating-your-installation-to-a-specific-release | |
- build succeeded but import failed. found https://github.com/davisking/dlib/issues/2097. dlib/__init__.py had some really odd choices of constructing the cuda/cudnn dll paths (hardcoded to do ../../bin). replaced them with the direct paths on my machine. | |
- even though import dlib then worked (which meant it found the expected dlls), when invoking dlib, still failed with "Could not locate cudnn_ops_infer64_8.dll. Please make sure it is in your library path!" | |
- (also tried these precompiled wheels, when installing, pip complained it was invalid, even though I picked the one for my python version - https://github.com/z-mahmud22/Dlib_Windows_Python3.x) | |
Ended up building dlib without cuda. wasted a whole afternoon. | |
(Win10, cuda 12.1, cudnn 9.1.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment