Issue with Boost and CMake on Mac Sierra when install dlib - python

So I've installed Boost via brew, similarly installed with cmake and python:
brew install boost --with-python3
brew install boost-python
brew install cmake
I'm currently using miniconda3 (python3.6) and am trying to install Dlib. So far I can install dlib fine, but when it comes to python setup, it fails. Dlib can be obtained by cloning the repo dlib_repo
Here I do python setup.py install, Getting the following errors
-- Detecting CXX compile features - done
CMake Warning at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindBoost.cmake:1518 (message):
No header defined for python-py34; skipping header check
Call Stack (most recent call first):
/Users/userx/dlib/dlib/cmake_utils/add_python_module:61 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
CMake Warning at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindBoost.cmake:1518 (message):
No header defined for python-py35; skipping header check
Call Stack (most recent call first):
/Users/userx/dlib/dlib/cmake_utils/add_python_module:63 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
CMake Warning at /usr/local/Cellar/cmake/3.7.2/share/cmake/Modules/FindBoost.cmake:1518 (message):
No header defined for python3; skipping header check
Call Stack (most recent call first):
/Users/userx/dlib/dlib/cmake_utils/add_python_module:66 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Boost version: 1.61.0
-- Found the following Boost libraries:
-- python3
-- Found PythonLibs: /Users/userx/miniconda3/lib/libpython3.5.dylib (found suitable version "3.5.2", minimum required is "3.4")
-- USING BOOST_LIBS: /Users/userx/miniconda3/lib/libboost_python3.dylib
-- USING PYTHON_LIBS: /Users/userx/miniconda3/lib/libpython3.5.dylib
...
...
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o] Error 1
make[1]: *** [dlib_build/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!
So here, I felt cmake couldn't find the boost variables, so I added these to my .bashrc and restarted my shell.
export BOOST_ROOT="/usr/local/Cellar/boost/1.63.0"
export BOOST_INCLUDE="/usr/local/Cellar/boost/1.63.0/include"
export BOOST_LIBDIR="/usr/local/Cellar/boost/1.63.0/lib"
Note these paths were found them via brew info and checked them to ensure correctness.
I'm using a macbook with Sierra OS - as I know Sierra has changed the way a lot of builds happen.
I have also tried to remove boost and download from the site and build directly, but same problem persists.
Any help much appreciated

It might be caused by the CMAKE_PREFIX_PATH setting.
I met the same problem and I solved it by this sequence:
First I install the boost using this:
brew install boost-python --with-python3
then I found the BOOST Not Found error when running the following commands to install the dlib 19.7.0:
pip install dlib --upgrade
So I edit the Bash Profile with following commands:
nano ~/.bash*le
and add the following line into this file:
export CMAKE_PREFIX_PATH="/usr/local:/usr/local/Cellar/boost/1.65.1:$PATH"
Notice
I am using the boost 1.65.1, which is installed at /usr/local/Cellar/boost/1.65.1, you might change it to the location that you install boost with brew.
after this step, I run pip install dlib --upgrade again on both python2.7.14 and 3.6.1 and 3.6.3, everything goes on the right way now.

I did the same in my system, except for one difference:
python3 setup.py install
Instead of
python setup.py install
And I don't see that error.

Related

CMake cant find installed Python Interpreter

My system is of Ubuntu 20.04 LTS having a python version 3.8.10. but while installing USRP open source tool chain UHD 3.14.0.0. there arises an error regarding python interpreter for cmake as follows
$ cmake ..
-
-- Configuring the python interpreter...
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.0")
-- Python interpreter: PYTHON_EXECUTABLE-NOTFOUND
-- Override with: -DPYTHON_EXECUTABLE=<path-to-python>
CMake Error at cmake/Modules/UHDPython.cmake:54 (message):
Error: Python interpreter required by the build system.
Call Stack (most recent call first):
cmake/Modules/UHDVersion.cmake:9 (include)
cmake/Modules/UHDPackage.cmake:9 (include)
CMakeLists.txt:110 (include)
-- Configuring incomplete, errors occurred!
See also "/home/capsys/workarea/uhd/host/build/CMakeFiles/CMakeOutput.log".
all the available python versions in my system as follows
$ python3 --version
Python 3.8.10`
$ ls /usr/bin/python*
/usr/bin/python3 /usr/bin/python3.8-config /usr/bin/python3.8-dbg /usr/bin/python3.8d-config /usr/bin/python3d /usr/bin/python3-dbg-config /usr/bin/python3-futurize
/usr/bin/python3.8 /usr/bin/python3.8d /usr/bin/python3.8-dbg-config /usr/bin/python3-config /usr/bin/python3-dbg /usr/bin/python3d-config /usr/bin/python3-pasteurize
why cant cmake find the installed libraries? is there any specific cmd to make cmake look for specific python library for build?
Do I need to install any specific version of python for this ?
$ cmake ..
-
-- Configuring the python interpreter...
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.0")
-- Python interpreter: PYTHON_EXECUTABLE-NOTFOUND
-- Override with: -DPYTHON_EXECUTABLE=<path-to-python>
CMake Error at cmake/Modules/UHDPython.cmake:54 (message):
Error: Python interpreter required by the build system.
Call Stack (most recent call first):
cmake/Modules/UHDVersion.cmake:9 (include)
cmake/Modules/UHDPackage.cmake:9 (include)
CMakeLists.txt:110 (include)
-- Configuring incomplete, errors occurred!
See also "/home/capsys/workarea/uhd/host/build/CMakeFiles/CMakeOutput.log".

CMake Error: could NOT find Python (missing: Python_NumPy_INCLUDE_DIRS NumPy) (found version "2.7.17")

I encounter with this error during my build
CMake Error at /opt/cmake-3.21.1-linux-x86_64/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Python (missing: Python_NumPy_INCLUDE_DIRS NumPy) (found
version "2.7.17")
Call Stack (most recent call first):
/opt/cmake-3.21.1-linux-x86_64/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/opt/cmake-3.21.1-linux-x86_64/share/cmake-3.21/Modules/FindPython.cmake:556 (find_package_handle_standard_args)
faiss/python/CMakeLists.txt:116 (find_package)
I've already installed sudo apt-get install python-dev and also tried adding
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
Still get the same error. My python is in /home/dfw/anaconda3/bin/python and its version is 3.7.11. My cmake version is 3.21.1. How can I fix this?
Cmake finds a python installed by apt in the /usr folder. There are two ways to tell Cmake the special location of python :
Set the Python3_ROOT_DIR variable
Set the CMAKE_PREFIX_PATH variable.
Defining the PYTHON_INCLUDE_DIR and PYTHON_LIBRARY variables on the command line does not work because these variables are overridden when you call find_package(python3).
Also when installing python-dev into the system you can explicitly specify that version 3 is required.
sudo apt-get install python3-dev

attempting to upgrade pyarrow results in errors

I ran this command to upgrade pyarrow from 2.0.0 to 3.0.0:
pip3 install --user --upgrade pyarrow
I got these errors:
Failed building wheel for pyarrow
...
-- Could NOT find Arrow (missing: Arrow_DIR)
-- Checking for module 'arrow'
-- No package 'arrow' found
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Arrow (missing: ARROW_INCLUDE_DIR ARROW_LIB_DIR
ARROW_FULL_SO_VERSION ARROW_SO_VERSION)
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake_modules/FindArrow.cmake:419 (find_package_handle_standard_args)
cmake_modules/FindArrowPython.cmake:46 (find_package)
CMakeLists.txt:214 (find_package)
How can I resolve this?
Pyarrow version 3.0 stopped shipping manylinux1 source in favor of only shipping manylinux2010 and manylinux2014 wheels.
This means that starting with pyarrow 3.0 you will need pip >= 19.0 if you would like to avoid building from source.
Please also note that the default version of pip on Ubuntu 18 is pip version 9 and so you will need to upgrade pip (I've found most users with this issues seem to be coming from Ubuntu 18).

bigARTM installation: Cmake Could NOT find Boost

I have an issue with bigARTM topic modelling library installing for python 3.7 on MacOs:
Firstly, I install Boost with pip install boost and Cmake with same line
and then, as follows in documentation for bigARTM(https://bigartm.readthedocs.io/en/stable/installation/linux.html#step-2-python-packages), do:
git clone --branch=stable https://github.com/bigartm/bigartm.git
cd bigartm
mkdir build && cd build
and ran Cmake ..
But get an error:
-- Build type: Release
CMake Error at /Users/username/opt/anaconda3/lib/python3.7/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR)
Call Stack (most recent call first):
/Users/username/opt/anaconda3/lib/python3.7/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/Users/username/opt/anaconda3/lib/python3.7/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.16/Modules/FindBoost.cmake:2179 (find_package_handle_standard_args)
CMakeLists.txt:134 (find_package)
I understand that Boost lib is the problem, but I had installed earlier.
What has go wrong? How to fix it? What should I do to have bigARTM installed?
Thanks in advance!

Unable to find the requested Boost libraries

Platform:macOS High Sierra
Hello,
I tried to use the method Building from source to install RDkit, there is something wrong when I entered cmake ..,the terminal shows that
CMake Warning at
/usr/local/Cellar/cmake/3.12.0/share/cmake/Modules/FindBoost.cmake:1723 (message):
No header defined for python-py36; skipping header check
Call Stack (most recent call first):
CMakeLists.txt:202 (find_package)
CMake Error at /usr/local/Cellar/cmake/3.12.0/share/cmake/Modules/FindBoost.cmake:2044 (message):
Unable to find the requested Boost libraries.
Boost version: 1.67.0
Boost include path: /usr/local/include
Could not find the following Boost libraries:
boost_python
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
But I have added /usr/local/Cellar/boost/lib and /usr/local/Cellar/boost-python/lib to the ~/.bash_profile.
My ~/.bash_profile is written like this:
export RDBASE=/Users/wangzhicheng/Software/RDkit/rdkit-Release_2018_03_3
export PYTHONPATH=$RDBASE
export DYLD_LIBRARY_PATH=$RDBASE/lib:/usr/local/Cellar/boost/1.67.0_1/lib:/usr/local/Cellar/boost-python/1.67.0/lib:/usr/local/lib:/usr/local/Cellar/boost-python3/1.67.0_1/lib
export PATH="/Users/wangzhicheng/anaconda3/bin:$PATH"
By the way, I had already installed boost, boost-python3 by homebrew.
So where is the problem?
I think I've found the solution to this problem.
The reason for the problem cmake want to find libboost_python3.dylib in your library folder but in fact this file is called libboost_python3x.dylib(x is depended on your python version), so you just need to type following command in your terminal:
cd /usr/local/lib
sudo ln -s libboost_python3x.dylib libboost_python3.dylib
and you can solve this error!

Categories