Boost not found when installing dlib, but its actually installed - opencv

Im trying to install dlib for few cv2 projects, but I have problems installing it.I made everything without problem but when I wanted to finally do the python setup.py install It showed me this error message: Could NOT find Boost (missing: python) (found suitable version "1.79.0", minimum required is "1.41.0")
I mean why doesnt it work when it sees my installed Boost 1.79...
Does somebody know how to fix it guys?
Thank you anyways:)

From error log it looks like boost libraries are found, but it's missing specific boost library to integrate with python
You have not mentioned which OS you are using for debian & it's derivatives
sudo apt-get install libboost-python-dev or if you are installing specific version of boost sudo apt-get install libboost-python1.79-dev should install the python module.
If boost is built from sources, during bootstrapping enable python libs to be built
./bootstrap.sh --with-libraries=python,filesystem,serialization
for list of boost libs can be built
./bootstrap.sh --show-libraries

Related

python3-wheel installed, still using legacy 'setup.py' when installing dlib

I've forked dlandon's Zoneminder project in order to build a Docker image using Debian Bullseye instead of Ubuntu, for i386 (I'm installing it into a 32-bit mini PC).
Part of the requiriments is installing dlib (latest is 19.22.0). I've installed the required dependencies (python3-pip, python3-setuptools and python3-wheel, as well as GCC and CMake).
When installing dlib, the terminal outputs:
Collecting dlib
Downloading dlib-19.22.0.tar.gz (7.4 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib: started
...
The relevant part is (even with python3-wheel installed)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
dlib builts successfully but takes a looong time to build, however. This happens with any packages supossed to use wheel.
I haven't found any (answered) questions about this specific issue, so, if there is something I missed, I would be told about that.
Everything is in the Dockerfile.
try pip install wheel in your env

installing old versions of cv2 using pip

i've been trying to download older versions of cv2 as an easy way to get around not being able to use SIFT.
I've tried the following:
pip install opencv-contrib-python==3.4.2.17
however I get this error:
ERROR: Could not find a version that satisfies the requirement opencv-contrib-python==3.4.2.17 (from versions: 3.4.8.29, 3.4.9.31, 3.4.9.33, 4.1.2.30, 4.2.0.32, 4.2.0.34)
ERROR: No matching distribution found for opencv-contrib-python==3.4.2.17
All the advice I've seen on the site so far tells me to either download these older versions of opencv or to build it myself (which seems like an absolute nightmare)
Anyone have any suggestions on how to install these older versions of cv2?
opencv-contrib-python 3.4.2.17 provides wheels for Pythons up to 3.7. Probably you use Python 3.8.
Use Python 3.7 (or lower). Or compile from sources for 3.8.

Attribute Error: MultiTracker_create() Not Found in cv2 on Raspberry Pi

I am currently trying to set up the opencv trackers on a Raspberry Pi. However, when I use the MultiTracker_create() function, it gives me an Attribution Error:
multiTracker = cv2.MultiTracker_create()
AttributeError: module 'cv2.cv2' has no attribute 'MultiTracker_create'
The same code works on my computer, but when I try it on the Pi, it experiences the above error. I am currently using Python 3.5 on the Raspi with OpenCV 3.4.4. My computer uses Python 3.7 with OpenCV 3.4.1.
Thank you in advance for your help.
I have made sure that I am using the correct package:
pip3 install opencv_contrib_python
I have also tried to look through the help(cv2) and could not find anything specific about the MultiTracker.
Just stumbled upon this myself. It appears that MultiTracker is no longer part of OpenCV 4.5.1, but you should be able to get it from the legacy package like this:
multiTracker = cv2.legacy.MultiTracker_create()
See https://docs.opencv.org/4.5.1/df/d4a/classcv_1_1legacy_1_1MultiTracker.html
Note that if you subsequently call multiTracker.add(...), you'll need to add the legacy version(s) of the trackers as well.
I've met the same problem and solved it. Maybe you can firstly do pip uninstall opecv-python and pip uninstall opencv-contrib-python, and then do pip install opencv-python==3.4.4.19 and pip install opencv-contrib-python==3.4.4.19. That's my solution, hope it's helpful.
This is an old thread, but I will add my answer, maybe helpful for someone facing same problem.
cv2.MultiTracker_create() is missing from OpenCV documentation also on 4.5.1.
[https://docs.opencv.org/4.5.1/d8/d77/classcv_1_1MultiTracker.html]
OpenCV contrib modules are known to be "unstable" which means that they can break or change. In my case, I had opencv-python and opencv-contrib-python both 4.5.2, but cv2.legacy.MultiTracker_create() was giving error.
Best solution is to uninstall opecv-python and opencv-contrib-python and reinstall version 4.4.0.46.
This will solve the problem.
pip install opencv-python==4.4.0.46
pip install opencv-contrib-python==4.4.0.46

sift = cv2.xfeatures2d.SIFT_create() not working even though have contrib installed

So I am trying to use:
sift = cv2.xfeatures2d.SIFT_create()
and it is coming up with this error:
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: error: (-213:The function/feature is not implemented)
This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake
option and rebuild the library in function 'cv::xfeatures2d::SIFT::create'
I am using Python 3.5.0 and opencv(3.4.3) and I am just using idle. This occured after I tried to install TensorFlow and I have tried looking around and have installed opencv-contrib-python but I am still getting the same error. Thank you in advance and I apologise if I have not included enough info
I had the same problem. It seems that SIRF and SURF are no longer available in opencv > 3.4.2.16. I chose an older opencv-python and opencv-contrib-python versions and solved this problem. Here is the history version about opencv-python, and I use the following code :
pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16
Edit
For Anaconda User just this instead of pip
conda install -c menpo opencv
this will install cv2 3.4.1 and everything you need to run SIFT
Since SIFT patent expired, SIFT has been moved to the main repo.
To use SIFT in Opencv, You should use cv2.SIFT_create() instead of cv2.xfeatures2d.SIFT_create() now. (xfeatures2d only exists in the contrib package, but sift is part of the main package now.)
Below link will be helpful.
https://github.com/opencv/opencv/issues/16736
Edit: The opencv-contrib-python-nonfree was removed from pypi.
On Linux/ MacOS, I've found a better solution! To access nonfree detectors use:
pip install opencv-contrib-python-nonfree
It may be due to a mismatch of opencv version and opencv-contrib version.
If you installed opencv from the source using CMake, and the source version is different from the version of opencv-contrib-python, uninstall the current opencv-contrib-python and do pip install opencv-contrib-python==<version of the source>.X or an another compatible version.
One version setup that I have running is opencv source (3.2), opencv-python (3.4.0.14) and opencv-contrib-python (3.4.2.17)

luarocks lyaml installation error

on luarocks install lyaml I get following error:
Error: Could not find expected file libyaml.a, or libyaml.so, or libyaml.so.* for YAML -- you may have to install YAML in your system and/or pass YAML_DIR or YAML_LIBDIR to the luarocks command. Example: luarocks install lyaml YAML_DIR=/usr/local
lua version: 5.1.5
How do I install YAML in system to start using lyaml rock?
Whenever you get a LuaRocks message saying you may have to install ____ in your system it means the rockspec has an external dependency.
Installing external dependencies
The way to satisfy this dependency is to install the package using the appropriate means of your system: if using Debian/Ubuntu, with apt-get, if using macOS, probably using Homebrew, etc.
Note that for building code, in systems that have the concept of dev packages, such as most Linux distributions, you need to install both the main library package and the dev package (which contains the header files for compilation). For example, for Debian/Ubuntu, to satisfy this dependency you need to run apt-get install libyaml libyaml-dev.
Unfortunately, the names are not fully consistent across systems and distros: a module may be called ncurses-dev in one system, libncurses6w-dev in another, etc. So in your particular case you'll have to search around for the right name of the YAML library (the package providing libyaml) in your system.
Once the external dependency is installed...
Installing a library with the system package manager will usually install the necessary files in locations that are automatically detected by LuaRocks, so running
luarocks install lyaml
again should find the libyaml files and proceed with the installation.
If external dependencies are installed in a non-standard location
If that fails, you can find the directories where the library (libyaml.so) and header (yaml.h) were installed and tell LuaRocks about it. For example, if libyaml.so was installed in some non-standard locations such as /opt/lib/yaml/libyaml.so and the header in /opt/include/yaml-1/yaml.h you would do this:
luarocks install lyaml YAML_LIBDIR=/opt/lib/yaml/ YAML_INCDIR=/opt/include/yaml-1/
This kind of situation happens when a system installs headers or libraries in a subdirectory. For example, for LuaSec on the Mac, which uses OpenSSL, it is sometimes necessary to use pathnames like this:
luarocks install luasec OPENSSL_INCDIR=/usr/local/opt/openssl/include OPENSSL_LIBDIR=/usr/local/opt/openssl/lib

Resources