I am writing a Django React web app and I am required to install Dlib for a specific component to work (to install face_recognition library). However I am unable to do so because I used Python 3.12 to create the virtual env whereas Dlib and Cmake only support up to Python 2.9, hence I am unable to install Dlib to my venv. I am using Windows 10 x64 Operating System.
Is there a way to change the Python version of the virtual environment?
Or what else can I do to install Dlib? Without losing progress?
I really don’t feel like starting over with a new venv made with Python 2.9 because I am almost halfway through development. Thanks in advance.
This is the error code I get when trying to install face_recognition using VSCode ->
Downloading face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Building wheels for collected packages: dlib, face-recognition-models
Building wheel for dlib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for dlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
<string>:210: SyntaxWarning: invalid escape sequence '\('
<string>:211: SyntaxWarning: invalid escape sequence '\('
<string>:212: SyntaxWarning: invalid escape sequence '\('
running bdist_wheel
running build
running build_ext
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\User\Documents\GitHub\codecalm-repo\env\Scripts\cmake.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'cmake'
ERROR: CMake must be installed to build dlib
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Building wheel for face-recognition-models (setup.py) ... done
Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566177 sha256=aea7948d7665696bbfc72f6aa9a1effe5c2ce1842746857937991bf958f27648
Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\8f\47\c8\f44c5aebb7507f7c8a2c0bd23151d732d0f0bd6884ad4ac635
Successfully built face-recognition-models
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects
venv
module, so you need a third-party one, likevirtualenv
.