(Please, excuse my bad English!) Got into trap while trying to install dlib library on my computer(Windows 10 Pro, 64x), but all the time get the same error: Could NOT find Boost
What I have already done:
Installed Visual Studio Community 2017 version 15.1
Installed Anaconda: Python 3.6.0
|Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)] on win32
Downloaded boost_1_64_0.7z and unpacked it
Ran bootstrap
b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
got the message: The Boost C++ Libraries were successfully built!
6.Next:
set BOOST_LIBRARYDIR=C:\Users\Lelek\boost_1_64_0\stage\lib
set BOOST_INCLUDEDIR=C:\Users\Lelek\boost_1_64_0
set BOOST_ROOT=C:\Users\Lelek\boost_1_64_0
set PATH=%PATH%;%BOOST_ROOT%;%BOOST_LIBRARYDIR%
7. On this stage if I try to run python setup.py install from dlib directory I get the output (the same error appears when try to call cmake -G "Visual Studio 15 2017 Win64" -DPYTHON3=1 .\tools\python):
CMake Warning at C:/Program Files/Cmake/share/cmake-3.8/Modules/FindBoost.cmake:1521 (message):
No header defined for python-py34; skipping header check
Call Stack (most recent call first):
C:/Users/Lelek/dlib-19.4/dlib/cmake_utils/add_python_module:61(FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
CMake Warning at C:/Program Files/Cmake/share/cmake-3.8/Modules/FindBoost.cmake:1521 (message):
No header defined for python-py35; skipping header check
Call Stack (most recent call first):
C:/Users/Lelek/dlib-19.4/dlib/cmake_utils/add_python_module:63 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
CMake Warning at C:/Program Files/Cmake/share/cmake-3.8/Modules/FindBoost.cmake:1521 (message):
No header defined for python3; skipping header check
Call Stack (most recent call first):
C:/Users/Lelek/dlib-19.4/dlib/cmake_utils/add_python_module:66 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
-- Could NOT find Boost
-- Found PythonLibs: C:/ProgramData/Anaconda3/libs/python36.lib (found suitable version "3.6.0", minimum required is "3.4")
-- We couldn't find the right version of boost python. If you installed boost and you are still getting this error then you might have installed a version of boost that was compiled with a different version of visual studio than the one you are using. So you have to make sure that the version of visual studio is the same version that was used to compile the copy of boost you are using.
-- Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake.
-- E.g. Something like this:
-- set BOOST_ROOT=C:\local\boost_1_57_0
-- set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib
--
-- You will also likely need to compile boost yourself rather than using one of the precompiled
-- windows binaries. Do this by going to the folder tools\build\ within boost and running
-- bootstrap.bat. Then run the command:
-- b2 install
-- And then add the output bin folder to your PATH. Usually this is the C:\boost-build-engine\bin
-- folder. Finally, go to the boost root and run a command like this:
-- b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
-- When it completes, set BOOST_LIBRARYDIR equal to wherever b2 put the compiled libraries.
-- Note that you will need to set the address-model based on if you want a 32 or 64bit python library.
--
-- Next, when you invoke cmake to compile dlib you may have to use cmake's -G option to set the
-- 64 vs. 32bit mode of visual studio. Also, if you want a Python3 library you will need to
-- add -DPYTHON3=1. You do this with a statement like:
-- cmake -G "Visual Studio 12 2013 Win64" -DPYTHON3=1 ..\..\tools\python
-- Rather than:
-- cmake ..\..\tools\python
-- Which will build a 32bit Python2 module by default on most systems.
--
--
CMake Error at C:/Users/Lelek/dlib-19.4/dlib/cmake_utils/add_python_module:116 (message):
Boost python library not found.
Call Stack (most recent call first):
CMakeLists.txt:6 (include)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Lelek/dlib-19.4/tools/python/build/CMakeFiles/CMakeOutput.log".
error: cmake configuration failed!
As usual for me, I found the answer, as soon as I asked question. So, if someone will get the same issue:
To solve his problem I deleted Anaconda and installed only Python(3.5.0). Then updated dlib using PyCharm. And again, excuse my bad English, please.
If anyone still has this problem, try changing all calls to FIND_PACKAGE inside dlib\cmake_utils\add_python_module from 'Boost' to 'boost'. Worked for me.
If, after finding boost, the installation tries to open python27.lib and fails:
Remove boost.
Repeat steps 2--6 from the original question AFTER activating your py36 environment in Anaconda.
Re-run the dlib setup.
The latter was a stupid mistake of mine, but just in case.
Related
I'm building OpenVDB on Windows 10 with Python support, but I need to compile it against Python 3.7.
The system-wide version of Python is 3.10 and the build works fine with that.
I use Anaconda to set up a Py3.7 environment with
conda create -n py37 python=3.7
Then I modify the CMakeLists.txt to look for this version of Python:
find_package(Python 3.7...<3.8 REQUIRED COMPONENTS Development.Module Interpreter)
In this environment, without any other changes, CMake still finds the system version of Python:
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Python: Found unsuitable version "3.10.2", required range is
"3.7...<3.8" (found
C:/dev/vcpkg/installed/x64-windows/tools/python3/python.exe, found
components: Development.Module Interpreter)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPython/Support.cmake:3172 (find_package_handle_standard_args)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPython.cmake:519 (include)
C:/dev/vcpkg/installed/x64-windows/share/python/vcpkg-cmake-wrapper.cmake:67 (_find_package)
C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake:761 (include)
openvdb/openvdb/python/CMakeLists.txt:120 (find_package)
Adding -DPython_EXECUTABLE=C:\Users\me\Anaconda3\envs\py37\python.exe at command line helps with finding the right the Python version, but there's still trouble with CMake:
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Python (missing: Development.Module) (found suitable version
"3.7.13", required range is "3.7...<3.8")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPython/Support.cmake:3172 (find_package_handle_standard_args)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPython.cmake:519 (include)
C:/dev/vcpkg/installed/x64-windows/share/python/vcpkg-cmake-wrapper.cmake:67 (_find_package)
C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake:761 (include)
openvdb/openvdb/python/CMakeLists.txt:120 (find_package)
What is exactly Development.Module, and is it really missing from the environment?
If yes, then how do I install it?
If no, then what do I need to add to the CMake scripts or command line to make it work?
I am trying to upgrade QGIS from 3.10 to 3.20 and this requires upgrading CMake to >=3.15 and Python >= 3.7. I am using an EOL Linux distribution (Fedora 28, upgrading the OS is the obvious easy fix but this has to be done on 28, no questions asked). I've installed both CMake (3.19.4) and Python (3.7.9) to my local directories, set them to path, and have added the following CMake options:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_SERVER=ON \
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.7 -D......
yet I receive the following error:
CMake Error at /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find Python (missing: Python_EXECUTABLE Interpreter) (found
suitable version "3.7.9", minimum required is "3.7")
Reason given by package:
Interpreter: Cannot use the interpreter "/usr/local/bin/python3.7"
Call Stack (most recent call first):
/usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.19/Modules/FindPython/Support.cmake:3148 (find_package_handle_standard_args)
/usr/local/share/cmake-3.19/Modules/FindPython.cmake:428 (include)
CMakeLists.txt:946 (find_package)
Any suggestions on how to proceed? I've added the flags "-DCMAKE_PYTHON_INCLUDE_DIR" and "-DCMAKE_PYTHON_LIBRARY", made sure I configured the local Python to have shared libraries enabled and this either changes nothing or reverts to finding the older Python on my path (3.6.8).
I'm trying to compile pybind11 on a Windows machine that has VisualStudio 2015 installed. I also have python 3.5.3 64bit installed, and cmake 2.8.12. I get the error:
CMake Error at tools/FindPythonLibsNew.cmake:122 (message):
Python config failure: Python is 64-bit, chosen compiler is 32-bit
Call Stack (most recent call first):
tools/pybind11Tools.cmake:16 (find_package)
CMakeLists.txt:28 (include)
I did not "choose" the compiler to be 32-bit, and looking at the CMakeLists.txt, I did not find any place to specify which compiler to run.
So how to I tell pybind11/cmake to compile for 64 bit?
You should specify the 64-bit VS compiler like so:
cmake "/path/to/src/" -G"Visual Studio 14 2015 Win64"
Otherwise it selects the 32-bit by default.
If you are using the Ninja generator and you have this error make sure you run the VS Dev command prompt in 64-bit mode:
VsDevCmd.bat arch=amd64 && cmake <options> ...
You can either do :
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build . --config Release --target check
or based on this quote from the Compiling the test cases for windows section here:
If all tests fail, make sure that the Python binary and the testcases
are compiled for the same processor type and bitness (i.e. either i386
or x86_64). You can specify x86_64 as the target architecture for the
generated Visual Studio project using cmake -A x64 ..
You can do :
cmake -A x64 ..
cmake --build . --config Release --target check
Good afternoon, help me please, I want to install dlib for python on windows, but when I write python.exe setup.py install in cmd in dlib dir or pip.exe install dlib I have this error:
CMake Warning at /usr/share/cmake-2.8.9/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/usr/share/cmake-2.8.9/Modules/CMakeSystemSpecificInformation.cmake:36 (INCLUDE)
-- Check for working C compiler: /usr/bin/gcc.exe
-- Check for working C compiler: /usr/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:2 (CMAKE_MINIMUM_REQUIRED):
CMake 2.8.12 or higher is required. You are running version 2.8.9
-- Configuring incomplete, errors occurred!
error: cmake configuration failed!
I try to update cygwin's cmake with Cygwin installer, but setup.py use the old version of cmake (2.8.9). I try to run setup.py from cygwin's console, but it doesn't see a Boost (But it installed on my computer). I have this error in cygwin:
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Boost
CMake Error at /usr/share/cmake-3.3.2/Modules/FindPythonLibs.cmake:168 (file):
file STRINGS file
"/cygdrive/c/dlib-19.4/tools/python/C:/Python27/include/patchlevel.h"
cannot be read.
Call Stack (most recent call first):
/cygdrive/c/dlib-19.4/dlib/cmake_utils/add_python_module:75 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
CMake Error at /usr/share/cmake- 3.3.2/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PythonLibs: Found unsuitable version "", but required is at
least "2.6" (found C:/Python27/libs/python27.lib)
Call Stack (most recent call first):
/usr/share/cmake-3.3.2/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.3.2/Modules/FindPythonLibs.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/cygdrive/c/dlib-19.4/dlib/cmake_utils/add_python_module:75 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Configuring incomplete, errors occurred!
error: cmake configuration failed!
Can I update cygwin's cmake for using it in cmd or make the cygwin's terminal to see Boost?
If you have anaconda you can try this
conda install -c menpo dlib=18.18
I had a lot of problems, when I tried to install it with pip, but with anaconda it was ok
Here is what I installed as described here:
1. Python 3.5 (Anaconda3 2.4.3)
Chainer 1.5.0.2
Cython 0.23.4
NumPy 1.10.1
tqdm
2. OpenCV 3.0.0
3. lmdb 0.87
4. Boost 1.59.0
Next I want to compile and install Boost.NumPy. In the beginning, NumPy module could not be found. After some search, I found NumPy-related files in ~/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy instead of something like /usr/lib, /usr/local/lib, etc. Therefore, in /Boost.NumPy/CMakeList.txt, I added this line:
set(NUMPY_INCLUDE_DIRS, /home/graphics/anaconda3/lib/python3.5/site-packages)
But NumPy still could not be found. An error occurred as I run cmake -DPYTHON_LIBRARY=$HOME/anaconda3/lib/libpython3.5m.so ../ to generate the makefile for Boost.NumPy. Here is the error:
graphics#gubuntu:~/usr/Boost.NumPy/build$ sudo cmake -DPYTHON_LIBRARY=$HOME/anaconda3/lib/libpython3.5m.so ../
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/bin/python3.5 (found suitable version "3.5.1", minimum required is "3.5")
-- Found PythonInterp: /usr/bin/python3.5 (found version "3.5.1")
-- Found PythonLibs: /home/graphics/anaconda3/lib/libpython3.5m.so
CMake Error at libs/numpy/cmake/FindNumPy.cmake:61 (message):
NumPy import failure:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
Call Stack (most recent call first):
CMakeLists.txt:30 (find_package)
-- Configuring incomplete, errors occurred!
I have tried to replace NUMPY_INCLUDE_DIRS with some other directories, but nothing works. What should I write to the CMakelists.txt to tell cmake where to find NumPy module and import it?
Thanks in advance!
Others files which might be needed to find out what goes wrong:
CMakeLists.txt of Boost.NumPy.
Finally it works! But I don't know why...:(
What I did:
1. I reinstalled numpy to /usr/lib/python3.5/site-packages (previously, I installed it to ~/anaconda3/lib/python3.4/site-packages)
1.1 I also added ~/anaconda3/lib/python3.4/site-packages/numpy/include to $PYTHONPATH and $PATH
2. I ran these commands in Python:
>>>import numpy
And I found it returns no error!
3. I removed previously compiled files in directory build, and rebuilt. Finally it worked
Hope these helps someone else.