Install fb-python on Linux machine - python

I am trying to install fb-python library -a bridge between Lua and Python:
https://github.com/facebookarchive/fblualib/tree/master/fblualib/python
on my Linux machine using the command
cd fblualib/fblualib/python
luarocks make rockspec/fbpython-0.1-1.rockspec
however all my attempts are encountering the error below:
cmake -E make_directory build &&
cd build &&
cmake -DROCKS_PREFIX=/home/current_user/torch/install/lib/luarocks/rocks/fbpython/0.1-1 \
-DROCKS_LUADIR=/home/current_user/torch/install/lib/luarocks/rocks/fbpython/0.1-1/lua \
-DROCKS_LIBDIR=/home/current_user/torch/install/lib/luarocks/rocks/fbpython/0.1-1/lib \
.. &&
make
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
REQUIRED_ARGS (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315
(_FPHSA_FAILURE_MESSAGE)
cmake/FindGlog.cmake:21 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:27 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
The file throwing the error is this: https://github.com/facebookarchive/fblualib/blob/master/fblualib/cmake/FindGlog.cmake
However, I have installed the Glog library https://github.com/google/glog/releases: given that I don't have sudo access to the machine, I set ./configure to a custom location that I probably need to specify now for the GLOG_INCLUDE_DIR and GLOG_LIBRARY flags. How to do this? Any suggestion is appreciated. Thank you!

Related

I'm getting cmake error while installing termuxa opencv

CMake Error at cmake/android/OpenCVDetectAndroidSDK.cmake:49 (message):
Android SDK: specify path to Android SDK via ANDROID_SDK_ROOT /
ANDROID_HOME / ANDROID_SDK variables
Call Stack (most recent call first):
cmake/android/OpenCVDetectAndroidSDK.cmake:172 (ocv_detect_android_sdk)
CMakeLists.txt:761 (include)
-- Configuring incomplete, errors occurred!
See also "/data/data/com.termux/files/usr/lib/python3.10/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/data/data/com.termux/files/usr/lib/python3.10/opencv/build/CMakeFiles/CMakeError.log".
I will install opencv on termux, but I get such an error, how can I solve it during configuration?
If my configuration is
LDFLAGS=" -llog -lpython3" cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_opencv_python3=on -DBUILD_opencv_python2=off -DWITH_QT=OFF -DWITH_GTK=OFF ..

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

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!

Issue with Boost and CMake on Mac Sierra when install dlib

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.

Categories