@@ -115,7 +115,45 @@ def get_cmake_version(self):
115115 try :
116116 out = subprocess .check_output (['cmake' , '--version' ])
117117 except :
118- sys .stderr .write ("\n ERROR: CMake must be installed to build dlib\n \n " )
118+ sys .stderr .write ("""
119+ ================================================================================
120+ ================================================================================
121+ ================================================================================
122+
123+ CMake is not installed on your system!
124+
125+ Or it is possible some broken copy of cmake is installed on your system.
126+ It is unfortunately very common for python package managers to include
127+ broken copies of cmake. So if the error above this refers to some file
128+ path to a cmake file inside a python or anaconda or miniconda path then you
129+ should delete that broken copy of cmake from your computer.
130+
131+ Instead, please get an official copy of cmake from one of these known good
132+ sources of an official cmake:
133+ - cmake.org (this is how windows users should get cmake)
134+ - apt install cmake (for Ubuntu or Debian based systems)
135+ - yum install cmake (for Redhat or CenOS based systems)
136+
137+ On a linux machine you can run `which cmake` to see what cmake you are
138+ actually using. If it tells you it's some cmake from any kind of python
139+ packager delete it and install an official cmake.
140+
141+ More generally, cmake is not installed if when you open a terminal window
142+ and type
143+ cmake --version
144+ you get an error. So you can use that as a very basic test to see if you
145+ have cmake installed. That is, if cmake --version doesn't run from the
146+ same terminal window from which you are reading this error message, then
147+ you have not installed cmake. Windows users should take note that they
148+ need to tell the cmake installer to add cmake to their PATH. Since you
149+ can't run commands that are not in your PATH. This is how the PATH works
150+ on Linux as well, but failing to add cmake to the PATH is a particularly
151+ common problem on windows and rarely a problem on Linux.
152+
153+ ================================================================================
154+ ================================================================================
155+ ================================================================================
156+ """ )
119157 sys .exit (1 )
120158 return re .search (r'version\s*([\d.]+)' , out .decode ()).group (1 )
121159
@@ -199,8 +237,7 @@ def read_version_from_cmakelists(cmake_file):
199237 return major + '.' + minor + '.' + patch
200238
201239def read_entire_file (fname ):
202- """Read text out of a file relative to setup.py.
203- """
240+ """Read text out of a file relative to setup.py. """
204241 return open (os .path .join (fname )).read ()
205242
206243setup (
0 commit comments