-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: cmake not found during dlib installation using pip (even though cmake installed correctly) #2961
Comments
After you installed cmake did you try to do the dilib build in a new window session like a new command prompt. You should close that window and open a new one ideally with Administrator access. Also, you need visual studio installed to compile dlib with cmake also. Is cmake in your path? If you enter cmake --version for example does it show you the build number? |
Open a windows command prompt and type cmake and hit enter. If it says command not found then cmake isn’t installed correctly. The copy of cmake in pip has been largely broken for years. You should install cmake from cmake.org. That will work and is the official place to get cmake. On Jun 2, 2024, at 8:45 AM, rickmaz ***@***.***> wrote:
After you installed cmake did you try to do the dilib build in a new window session like a new command prompt. You should close that window and open a new one ideally with Administrator access. Also, you need visual studio installed to compile dlib with cmake also. Is cmake in your path? If you enter cmake --version for example does it show you the build number?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Hi, installing cmake from apt works, yes, but for whatever reason, dlib=19.24.2 can be installed using the pip cmake but not dlib=19.24.4. |
@davisking checked if cmake is in path, and it is PS C:\Users\athar> cmake --version
cmake version 3.28.1
CMake suite maintained and supported by Kitware (kitware.com/cmake). also i can build dlib with cmake but then can i use it with virtual environment that way? when i researched i got answers saying that i can't. |
@lefteryx i tried it out, and dlib 19.24.2 installs with |
I'm not able to reproduce this. For me Note that that error is saying cmake isn't in your |
Just to confirm and make sure we're on the same page, I meant that I can install |
Oh that is probably it, thank you very much for your response! |
Confirmed. |
What worked for me: [Windows]
if still this did not work then install Visual C++ from microsoft website, restart pc and try again! |
same i cant find the reason why i cant able to install this dlib=19.12.4. |
Same problem. wt do ? |
If you open a terminal window and type cmake and hit enter what happens? I'm talking about the same terminal window you would use to install dlib. If when you type cmake in that window you get an error about cmake not being found then it's not installed correctly. So you have to install cmake such that opening a terminal window and typing cmake and hitting enter doesn't give an error. On windows the simplest way to do that is to use the installer from cmake.org. To say that real clearly, in whatever window you use to type the install command for dlib. First just type cmake and hit enter. If you get an error stop and do not attempt to install dlib. First get cmake installed. |
Check: cmake:
Export path
(lto-wrapper at the end takes time) Check dlib installation:
|
Install from git is not the best way. I hit same error on CentOS, sadly I can not resolved it by using apt something, yum install cmake just doesn't work, even tough my cmake (pip) and yum already install. Still throw error. pip install dlib (latest):
pip install dlib==19.24.2
@davisking Can u just take a look at the build script difference between them? So many users claimed that it must have some miss looked imports in build script, please take a look, they shouldn't have behaviored so weired among all users. Thanks for the lib! |
same problem here, trying to install CMake and then dlib in a Python venv v3.12 and got the error message: error: subprocess-exited-with-error
× Building wheel for dlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
<string>:196: SyntaxWarning: invalid escape sequence '\('
<string>:197: SyntaxWarning: invalid escape sequence '\('
<string>:198: 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:\dev\facial_recognition\.venv\Scripts\cmake.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'cmake'
ERROR: CMake must be installed to build dlib
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib) |
sudo apt update && sudo apt upgrade -y sudo apt install -y python3 python3-pip python3-venv cmake git build-essential sudo adduser --disabled-password --gecos "" faceuser
sudo mkdir -p /home/faceuser/faceapp sudo chown faceuser:faceuser /home/faceuser/faceapp
sudo -i -u faceuser
cd /home/faceuser/faceapp
python3 -m venv facevenv
source facevenv/bin/activate
pip install cmake
which cmake
export CMAKE=$(which cmake)
cmake --version
git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build
cmake ..
cmake --build .
cd ..
python3 setup.py install
python3 -c "import dlib; print(dlib.version)"
cd.. pip install face_recognition
python3 -c "import face_recognition; print(face_recognition.version)" |
@lucasjinreal, what exactly did you type to get these errors? The dlib setup.py file does not |
@mayrinkdotcom go to cmake.org, download their installer, and install it on your system. In the installer make sure you add cmake to your PATH when it asks if you want to do that. |
@Boetty I'm not sure what your post is saying, but anyone using just python does not need to ever run any cmake build commands. Doing stuff like |
@davisking Hello. Here is the issue. I merely executed |
I'm not able to reproduce this. Frankly, what it looks like is What needs to happen is we somehow forbid use of any pip installed cmake. For years and years now various python package systems have offered to install cmake but many of them include broken copies of cmake. Like the But what you need to do is figure out how to get the real cmake in your PATH, then this will all work fine. Like if you do |
I pushed a new version of dlib just now that will print a much more informative error message about this when it happens to people in the future :) |
@davisking Thank you for your feedback and the helpful explanations. I understand that typically, Python users should not need to manually run cmake .. and cmake --build . when installing dlib via pip. However, in my specific environment, I encountered an issue that made these steps necessary. Even though I installed cmake via pip, it wasn’t detected during the build process, which led me to manually clone dlib and run the build process directly using cmake. This approach ensured (in my Environment)that cmake was properly utilized, allowing the installation to complete successfully. While this may not be required in other environments, it was the only solution that worked in my case. That’s why I chose to follow this path. Thank you again for your support and for taking the time to address this. I greatly appreciate your efforts and your direct involvement in helping to resolve these issues. Thanks for your time and the new Version. BoeTTY |
|
@davisking Thank you again for your response. I'm not sure what's being discussed online, but I do know that I spent days working with CMake and dlib in order to install face_recognition. In my case, it only worked with these commands. Why that is, and what exactly happened in the background, I don't know. But in the end, it's not important to me to debate these two commands, which were necessary in my situation. I just wanted to help others who might have had the same problems, because I know how exhausting it was for me to spend days getting it to work. As far as I know, there are no other ways to install face_recognition without CMake/dlib. I was simply relieved when it finally worked after days of effort, thanks to the experience I had, and I wanted to share that experience to make it easier for others. That's all. BoeTTY |
Sure, I get that. I think what threw you off is the mine field of broken cmake packages in pypi :( And what happened somewhere along your journey is you ended up with a non-broken cmake installed and then |
Warning: this issue has been inactive for 35 days and will be automatically closed on 2024-09-25 if there is no further activity. If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search. |
What Operating System(s) are you seeing this problem on?
Windows
dlib version
19.24.4
Python version
3.12.1
Compiler
gcc
Expected Behavior
using pip in a virtual environment, install
cmake
usingpip install cmake
. then installdlib
usingpip install dlib
. dlib installs successfullyCurrent Behavior
i've already installed
cmake
throughpip
. when i try to installdlib
through pip, it tries to findcmake
to build the wheel, however it is not able to.cmake
requirement is already satisfied. i am using a virtual envrinoment.cmake.exe
is also present invenv/Scripts
Steps to Reproduce
install dlib
(venv) PS C:\myFiles\dev\Hair_Style_Recommendation> pip install dlib
pip throws the following error
so i then check if cmake is installed. it is already installed.
cmake.exe
is also present invenv/Scripts
however, it still cannot find it and installation fails
Anything else?
i am using windows 11
23h2
. python version3.12.1
. pip version24.0
. cmake version (from pip)3.29.3
The text was updated successfully, but these errors were encountered: