andrewssobral / bgslibrary

A C++ Background Subtraction Library with wrappers for Python, MATLAB, Java and GUI on QT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

i cant install by pip install

TheMasterRoot opened this issue · comments

im trying to install your lib by PIP but im getting some errors
i instaled all requirements and i have opencv in system path,


Microsoft Windows [versão 10.0.18363.959]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\MasterRoot>pip install pybgs
Collecting pybgs
  Downloading pybgs-3.0.0.post2.tar.gz (850 kB)
     |████████████████████████████████| 850 kB 3.3 MB/s
Building wheels for collected packages: pybgs
  Building wheel for pybgs (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MasterRoot\\AppData\\Local\\Temp\\pip-install-6b5xsb2g\\pybgs\\setup.py'"'"'; __file__='"'"'C:\\Users\\MasterRoot\\AppData\\Local\\Temp\\pip-install-6b5xsb2g\\pybgs\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\MasterRoot\AppData\Local\Temp\pip-wheel-mxwnwkf9'
       cwd: C:\Users\MasterRoot\AppData\Local\Temp\pip-install-6b5xsb2g\pybgs\
  Complete output (47 lines):
  running bdist_wheel
  running build
  running build_ext
  Preparing the build environment
  Configuring cmake project
  C:\Python38-32\Scripts\cmake.exe -HC:\Users\MasterRoot\AppData\Local\Temp\pip-install-6b5xsb2g\pybgs -Bbuild\temp.win32-3.8\Release -DPYTHON_EXECUTABLE=c:\python38-32\python.exe -DBGS_CORE_STATIC=ON -DBGS_PYTHON_SUPPORT=ON -DBGS_PYTHON_ONLY=ON -DBGS_PYTHON_VERSION=3.8
  -- Building for: Visual Studio 15 2017
  -- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
  -- The C compiler identification is MSVC 19.16.27035.0
  -- The CXX compiler identification is MSVC 19.16.27035.0
  -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
  -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- 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: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  --
  -- BGS_PYTHON_SUPPORT: ON
  -- BGS_PYTHON_ONLY:    ON
  -- BGS_CORE_STATIC:    ON
  -- PYTHON VERSION: 3.8
  CMake Error at CMakeLists.txt:113 (find_package):
    By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "OpenCV", but
    CMake did not find one.

    Could not find a package configuration file provided by "OpenCV" with any
    of the following names:

      OpenCVConfig.cmake
      opencv-config.cmake

    Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
    "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
    provides a separate development package or SDK, be sure it has been
    installed.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/MasterRoot/AppData/Local/Temp/pip-install-6b5xsb2g/pybgs/build/temp.win32-3.8/Release/CMakeFiles/CMakeOutput.log".
  error: command 'C:\\Python38-32\\Scripts\\cmake.exe' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pybgs
  Running setup.py clean for pybgs
Failed to build pybgs
Installing collected packages: pybgs
    Running setup.py install for pybgs ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MasterRoot\\AppData\\Local\\Temp\\pip-install-6b5xsb2g\\pybgs\\setup.py'"'"'; __file__='"'"'C:\\Users\\MasterRoot\\AppData\\Local\\Temp\\pip-install-6b5xsb2g\\pybgs\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MasterRoot\AppData\Local\Temp\pip-record-erp0f12n\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38-32\Include\pybgs'
         cwd: C:\Users\MasterRoot\AppData\Local\Temp\pip-install-6b5xsb2g\pybgs\
    Complete output (47 lines):
    running install
    running build
    running build_ext
    Preparing the build environment
    Configuring cmake project
    C:\Python38-32\Scripts\cmake.exe -HC:\Users\MasterRoot\AppData\Local\Temp\pip-install-6b5xsb2g\pybgs -Bbuild\temp.win32-3.8\Release -DPYTHON_EXECUTABLE=c:\python38-32\python.exe -DBGS_CORE_STATIC=ON -DBGS_PYTHON_SUPPORT=ON -DBGS_PYTHON_ONLY=ON -DBGS_PYTHON_VERSION=3.8
    -- Building for: Visual Studio 15 2017
    -- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
    -- The C compiler identification is MSVC 19.16.27035.0
    -- The CXX compiler identification is MSVC 19.16.27035.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- 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: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    --
    -- BGS_PYTHON_SUPPORT: ON
    -- BGS_PYTHON_ONLY:    ON
    -- BGS_CORE_STATIC:    ON
    -- PYTHON VERSION: 3.8
    CMake Error at CMakeLists.txt:113 (find_package):
      By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "OpenCV", but
      CMake did not find one.

      Could not find a package configuration file provided by "OpenCV" with any
      of the following names:

        OpenCVConfig.cmake
        opencv-config.cmake

      Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
      "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
      provides a separate development package or SDK, be sure it has been
      installed.


    -- Configuring incomplete, errors occurred!
    See also "C:/Users/MasterRoot/AppData/Local/Temp/pip-install-6b5xsb2g/pybgs/build/temp.win32-3.8/Release/CMakeFiles/CMakeOutput.log".
    error: command 'C:\\Python38-32\\Scripts\\cmake.exe' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MasterRoot\\AppData\\Local\\Temp\\pip-install-6b5xsb2g\\pybgs\\setup.py'"'"'; __file__='"'"'C:\\Users\\MasterRoot\\AppData\\Local\\Temp\\pip-install-6b5xsb2g\\pybgs\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MasterRoot\AppData\Local\Temp\pip-record-erp0f12n\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38-32\Include\pybgs' Check the logs for full command output.

C:\Users\MasterRoot>

我也遇到过,刚刚解决,方案:
1.这里的opencv是C++的opencv,不是python的,所以需要下载一个c++的 (我下载的是3.4.2版本), 还要配置opencv的环境变量
opencv下载地址:https://opencv.org/releases.html#

2.在系统环境中,新增一个环境变量:OpenCV_DIR,地址为opencv的lib (如,我的是:C:\opencv\build\x64\vc15\lib)
配置讲解:https://blog.csdn.net/maizousidemao/article/details/81474834
(注:如果不是用vs开发,可以忽略 “三、部署opencv”)

3.我是在windows下安装的,这个时候输入“pip install pybgs” 还会有个“-j8”的错误,解决方法:
下载源码,通过源码安装,删除setup.py文件中的169行中的”-j8“项,之后安装成功,并能正常使用;
如果是linux下,这一步可能不会有问题。

thank you

wqc007你好,谢谢你的帮助,按照你提供的步骤做了,但是后面还是报错。
`- Found PythonInterp: E:/ProgramFiles/Anaconda3/python.exe (found suitable version "3.7.4", minimum required is "3.7")

CMake Error at modules/pybind11/tools/FindPythonLibsNew.cmake:127 (message):

Python config failure: Python is 64-bit, chosen compiler is 32-bit

Call Stack (most recent call first):

modules/pybind11/tools/pybind11Tools.cmake:16 (find_package)

modules/pybind11/CMakeLists.txt:33 (include)`

删除setup.py文件中第169行的”-j8“项后,这个问题也没有解决,请问你遇到过这个问题吗?请教下您如何解决?
@wqc007

我也遇到过,刚刚解决,方案:
1.这里的opencv是C ++的opencv,不是python的,所以需要下载一个c ++的(我下载的是3.4.2版本),还要配置opencv的环境变量
opencv下载地址:https : //opencv.org/releases.html#

2.在系统环境中,添加一个环境变量:OpenCV_DIR,地址为opencv的lib(如,我的是:C:\ opencv \ build \ x64 \ vc15 \ lib)
配置讲解:https://blog.csdn .net / maizousidemao / article / details / 81474834
(注:如果不是用vs开发,可以忽略“三,部署opencv”)

3.我是在windows下安装的,这个时候输入“ pip install pybgs”将会有个“ -j8”的错误,解决方法:
下载源码,通过源码安装,删除setup.py文件中的169行中的” -j8”项,之后安装成功,并能正常使用;
如果是linux下,这一步可能不会有问题。

您好,我也有这种错误,但是您的方案我试过了,还是有错。python 3.6 ,opencv3.4.2,请问您是否知道还有什么原因会导致此结果?

@momo-github-1984
你好,我的问题解决了,不晓得您是不是类似的问题。我pip不成功,就自己下载的源码,并下载CMake,自己编译,在cmakelists.txt的本级目录新建文件夹build,之后在build文件夹中打开cmd,输入cmake -D OpenCV_DIR=%OpenCV_DIR% -D BGS_PYTHON_SUPPORT=ON -G "Visual Studio 14 Win64" ..
就成功了。希望能帮到你。

image

Hello @wanglu-nj @momo-github-1984 @TheMasterRoot @wqc007
Should I consider this problem solved?
For info, I just released a new version of the BGSLibrary, now v3.1.0.
I tested it on Windows, Mac and Linux, both compiling the C++ library on OpenCV 3.4.7, 3.4.16 and 4.6.0.
I also tested its respective Python wrapper and GT user interface.
Python package: https://pypi.org/project/pybgs/3.1.0.post0/
Docker files: https://github.com/andrewssobral/docker/tree/master/bgslibrary
Updated installation steps on Windows:
https://github.com/andrewssobral/bgslibrary/wiki/Installation-instructions---Windows#how-to-compile-on-windows-10--msvs2019--opencv-347
Everything is working for me, could you please check in your side if this new version fix your issues?
Thanks in advance,
Andrews