Comments (10)
Hello @Nuwan1654 thanks for reporting this issue.
Can you check please if you have numpy installed ? or send me the output of the following commands:
pip -V
pip list
from bgslibrary.
Here are the outputs. I installed NumPy but
pip -V:
pip 20.0.2 from /home/dinusha/.virtualenvs/bs/lib/python3.8/site-packages/pip (python 3.8)
pip list:
Package Version
numpy 1.24.4
pip 20.0.2
pkg-resources 0.0.0
setuptools 44.0.0
wheel 0.34.2
from bgslibrary.
@Nuwan1654 try this:
cmake -D BGS_PYTHON_SUPPORT=ON \
-D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") ..
from bgslibrary.
@andrewssobral thanks for looking into this, I tried but still got the same error. I am running this on a virtual python environment. When I try to install in the default python environment with pip install pybgs
. it also getting a different error, but I see the NUMPY_INCLUDE_DIR: /home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include
Here is the error for pip install pybgs
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.8")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so
-- pybind11 v2.3.dev1
--
-- Python library status:
-- executable: /usr/bin/python3
-- library: /usr/lib/x86_64-linux-gnu/libpython3.8.so
-- include path: /usr/include/python3.8
-- NUMPY_INCLUDE_DIR: /home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include
-- Bulding bgslibrary_core STATIC
--
-- The bgslibrary python package will be installed at: lib/python3/dist-packages
-- Configuring done
CMake Error at CMakeLists.txt:223 (add_library):
No SOURCES given to target: bgslibrary_core
CMake Generate step failed. Build files cannot be regenerated correctly.
error: command 'cmake' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pybgs
from bgslibrary.
@Nuwan1654
Thanks for those inputs.
I need to check why pybgs is generating this error, it's very strange.
Can you try to build the bgs library by manually setting the NUMPY_INCLUDE_DIR, like:
cmake -D BGS_PYTHON_SUPPORT=ON -D NUMPY_INCLUDE_DIR=/home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include ..
from bgslibrary.
Hi @andrewssobral thanks for helping me. Now the numpy error is gone, It seems like an issue with cmake.
error left is
CMake Error at CMakeLists.txt:161 (add_subdirectory):
The source directory
/home/dinusha/codebase/bs/bgslibrary/modules/pybind11
does not contain a CMakeLists.txt file.
--
-- Python library status:
-- executable:
-- library: /usr/lib
-- include path:
-- NUMPY_INCLUDE_DIR: /home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include
-- Bulding bgslibrary_core SHARED
CMake Error at CMakeLists.txt:242 (pybind11_add_module):
Unknown CMake command "pybind11_add_module".
-- Configuring incomplete, errors occurred!
See also "/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeOutput.log".
See also "/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeError.log".
Here is the content of the CMakeError.log
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_3076c/fast && /usr/bin/make -f CMakeFiles/cmTC_3076c.dir/build.make CMakeFiles/cmTC_3076c.dir/build
make[1]: Entering directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3076c.dir/src.c.o
/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -fPIE -o CMakeFiles/cmTC_3076c.dir/src.c.o -c /home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_3076c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3076c.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_3076c.dir/src.c.o -o cmTC_3076c
/usr/bin/ld: CMakeFiles/cmTC_3076c.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_3076c.dir/build.make:87: cmTC_3076c] Error 1
make[1]: Leaving directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_3076c/fast] Error 2
Source file was:
#include <pthread.h>
void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_a7086/fast && /usr/bin/make -f CMakeFiles/cmTC_a7086.dir/build.make CMakeFiles/cmTC_a7086.dir/build
make[1]: Entering directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a7086.dir/CheckFunctionExists.c.o
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE -o CMakeFiles/cmTC_a7086.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_a7086
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a7086.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_a7086.dir/CheckFunctionExists.c.o -o cmTC_a7086 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_a7086.dir/build.make:87: cmTC_a7086] Error 1
make[1]: Leaving directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_a7086/fast] Error 2
from bgslibrary.
@Nuwan1654 , perfect!
The new error you encountered is related to the missing submodules of the bgslibrary repository, specifically the pybind11
submodule. Typically, we should clone the bgslibrary using the --recursive
option, but you can also run the following command after cloned repo:
git submodule update --init --recursive
After running this command, you can proceed to execute the cmake command.
from bgslibrary.
@andrewssobral Thank you very much, Now I have built it successfully, but in the guidelines, it says (add 'pybgs.so' to your Python path)
But in the build directory I have pybgs.cpython-38-x86_64-linux-gnu.so
How can I add this to the python path
from bgslibrary.
@Nuwan1654 perfect!
To add the bgslibrary build directory to the PYTHONPATH environment variable, you can use the following command:
export PYTHONPATH="${PYTHONPATH}:/root/bgslibrary/build"
Make sure to replace /root/bgslibrary/build
with the correct path to your bgslibrary build directory.
from bgslibrary.
great thanks again for the help
from bgslibrary.
Related Issues (20)
- For the available algorithm for a comprehensive comb
- Why does the following three foreground people exist all the time? HOT 2
- Pip install pybgs doesn't work on MacOS HOT 5
- What's the default algorithm used in bgs? HOT 3
- Unresolved external symbol: LNK2001 HOT 1
- Importing pybgs crashes python runtime HOT 3
- Importing python library on M1 chip MacOS HOT 1
- Memory leak
- XML files for algorithms? HOT 1
- why using abs(dist*dist) for the one channel image in PBAS.cpp HOT 2
- Unable to Install pybgs from PyPI(via pip install) on Google Colab Ubuntu 20.04 LTS Instance HOT 2
- Many of the algorithms present in pybgs raise an exception when invoked on Google Colab
- Opencv compilation HOT 1
- Bgslibrary库是针对视频的 如何针对图片,我想只提供一两张图片 然后获取到背景 这样可以么 HOT 2
- [OpenCV 5.0] \bgslibrary\algorithms\KDE\NPBGSubtractor.h(12,17): error C2059: 语法错误:“常数” HOT 4
- Error installing with pip : error: metadata-generation-failed HOT 6
- CMake issue running 'pip install pybgs' on Ubuntu HOT 1
- building project "bgs_python.vcxproj" -- FAILED (WIN10) HOT 2
- Cmake(?) error when running pip install pybgs on Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bgslibrary.