Open txytju opened 5 years ago
same issue
Could you provide more info on your environment? Such as your opencv version
environment:Python 3.6.8 GCC 7.3.0 opencv4.1.0
the same issue.
Hi @LuZeking, your issue seems a different one. Please refer to the new issue here.
My opencv version is 3.4.3
遇到同样的问题,ubuntu18.04 python 3.5
Firstly, you should clone https://github.com/GothicAi/cython-global-matting.git
Then modify setup.py line 9,10,11
libs = os.popen('ldconfig -p | grep libopencv')
libs = libs.readlines()
lib_paths = [l.split('=>')[-1].strip('\n').strip(' ') for l in libs]
Opencv lib path is not /usr/lib in some user's environment, maybe in /usr/local/lib, So the lib_paths is []. You should find your opencv lib path to correct the lib_paths.
Secondly, Set LD_LIBRARY_PATH={your opencv lib path} in your bash.
Lastly, you should modify line 37, modify opencv2 path according to their own environment, maybe /usr/local/opencv2, then run python setup.py install
Thanks, folks! We are currently looking into this issue and will update the pip package these days. Sorry for any inconvenience.
Hi! These problem may be caused by our opencv-mat package. If you do not have opencv(c++ version, not opencv-python) in our default path, or your OpenCV version is 3.x or above, errors may occur.
We have updated opencv-mat package version 0.1.3 on PyPI and this may solve the path problem. Our code can automatically search opencv source files and libs instead of using default path.
However, we are still working on the version problem. We recommend users to use python3.5 or 3.6 and OpenCV 2.x to avoid some errors for opencv-mat==0.1.3. We show some instructions here to help users to install OpenCV 2.x.
Sorry for these errors, and thank you for your affirmation of our work.
Something is still missing while installing opencv-mat
Something is still missing while installing opencv-mat
It looks like that your opencv_libs path is wrong. you should correct opencv_libs path like installing opencv-mat
@LL-Lee
I followed your guide of conda, just like this
and I think setup scripts can find opencv automatically
environment:Python 3.6.8 GCC 7.3.0 opencv4.1.0
I meet the same issue as you.Have you saved this issue yet?Can you tell me how to save this issue?Thanks.
environment:Python 3.6.8 GCC 7.3.0 opencv4.1.0
I meet the same issue as you.Have you saved this issue yet?Can you tell me how to save this issue?Thanks.
Try to downgrade the opencv to version 2.0 just like described here
I have solve this issue in the following way.First,i download opencv_mat-0.1.3.tar.gz and unzip it.Then i add opencv2 folder which is copied from /home/brook/anaconda3/envs/py36/include in the unziped opencv_mat-0.1.3 floder.And my opencv version is opencv-nopython _2.4.9 _salilab.At last,i zip opencv_mat-0.1.3 and use pip installing it. Although,i have solve the isssue in this way, i still don't know whether it will work normally.
@BrookXuan Thanks for your suggestion! We will investigate it.
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue.
ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i
Do you have any idear to save this problam?
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue.
ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i
Do you have any idear to save this problam?
I have meet this problem, have you solved it?
For those who have successfully compiled but meet errors like "ImportError: undefined symbol":
We have met a similar situation (once) on our machine and it is probably caused by incorrect dynamic linking. You may try settingLD_LIBRARY_PATH
but the underlying reason differs among environments, and we have not found a universal cure to all this kind of issues.
Currently, we are still struggling to solve the dependency problem among heterogeneous environments (this seems a universal problem for all CPP projects). We are sorry about the inconvenience, and, as always, any suggestion is welcomed. Thank you all!
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue.
ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i
Do you have any idear to save this problam?
same problem, any solution?
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue. ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i Do you have any idear to save this problam?
same problem, any solution?
I have saved this problam by installing opencv-3.4.7 in system (https://github.com/GothicAi/cython-global-matting). It takes me a lot of time to do that.And except the author's way,there are many articles in the wed teaching you how to install opencv3 in ubuntu16.04. Thanks author‘s share,i have integrated instaBoost into my mxnet.
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue. ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i Do you have any idear to save this problam?
same problem, any solution?
I have saved this problam by installing opencv-3.4.7 in system (https://github.com/GothicAi/cython-global-matting). It takes me a lot of time to do that.And except the author's way,there are many articles in the wed teaching you how to install opencv3 in ubuntu16.04. Thanks author‘s share,i have integrated instaBoost into my mxnet.
It is great! Can you share your settings ? I got the errors:
from opencv_mat import global_matting, guided_filter
ImportError: /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5: undefined symbol: _Z12qTriangulateRK11QVectorPathRK10QTransformd
I don't know how to fix it. : (
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue. ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i Do you have any idear to save this problam?
same problem, any solution?
I have saved this problam by installing opencv-3.4.7 in system (https://github.com/GothicAi/cython-global-matting). It takes me a lot of time to do that.And except the author's way,there are many articles in the wed teaching you how to install opencv3 in ubuntu16.04. Thanks author‘s share,i have integrated instaBoost into my mxnet.
It is great! Can you share your settings ? I got the errors: from opencv_mat import global_matting, guided_filter ImportError: /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5: undefined symbol: _Z12qTriangulateRK11QVectorPathRK10QTransformd
I don't know how to fix it. : (
I don't know how that happens.Maybe,your system is lack of this lib.In the same path,i find libQt5OpenGL.so.5 in my system.
@rogerwwww I have already used conda to set enviroment which is include opencv-nopython, cython numpy, opencv-mat and instaboost.But when i try to import instaboost, i met this issue. ImportError: /home/brook/anaconda3/envs/py36/lib/python3.6/site-packages/opencv_mat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv9ExceptionC1EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_i Do you have any idear to save this problam?
same problem, any solution?
I have saved this problam by installing opencv-3.4.7 in system (https://github.com/GothicAi/cython-global-matting). It takes me a lot of time to do that.And except the author's way,there are many articles in the wed teaching you how to install opencv3 in ubuntu16.04. Thanks author‘s share,i have integrated instaBoost into my mxnet.
It is great! Can you share your settings ? I got the errors: from opencv_mat import global_matting, guided_filter ImportError: /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5: undefined symbol: _Z12qTriangulateRK11QVectorPathRK10QTransformd I don't know how to fix it. : (
I don't know how that happens.Maybe,your system is lack of this lib.In the same path,i find libQt5OpenGL.so.5 in my system.
Yes, I had the libQt5OpenGL.so.5 too. When I run the yolack's train.py ,it is ok. But when I run the mmdetection's train.py, I got this error. Do you try mmdetection's train.py?
When installing instaboost, the follow error occured.
Building wheel for opencv-mat (setup.py) ... error ERROR: Complete output from command /opt/conda/envs/maskrcnn/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-qqkxalw5/opencv-mat/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 /tmp/pip-wheel-8b31un05 --python-tag cp37: ERROR: running bdist_wheel running build running build_ext building 'opencv_mat' extension creating build creating build/temp.linux-x86_64-3.7 gcc -pthread -B /opt/conda/envs/maskrcnn/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include -I/usr/include/opencv2 -I/opt/conda/envs/maskrcnn/include/python3.7m -c opencv_mat.cpp -o build/temp.linux-x86_64-3.7/opencv_mat.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0, from /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12, from /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from opencv_mat.cpp:787: /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
warning "Using deprecated NumPy API, disable it with " \
In file included from opencv_mat.cpp:789:0: /usr/include/opencv2/core/core.hpp:221:0: warning: "CV_Error" redefined
define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, CV_Func, FILE, LINE) )
^ In file included from /usr/local/include/opencv2/core.hpp:54:0, from /usr/local/include/opencv2/core/types_c.h:101, from /usr/include/opencv2/core/core.hpp:49, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/base.hpp:431:0: note: this is the location of the previous definition
define CV_Error( code, msg ) cv::error( code, msg, CV_Func, FILE, LINE )
^ In file included from opencv_mat.cpp:789:0: /usr/include/opencv2/core/core.hpp:222:0: warning: "CVError" redefined
define CVError( code, args ) cv::error( cv::Exception(code, cv::format args, CV_Func, FILE, LINE) )
^ In file included from /usr/local/include/opencv2/core.hpp:54:0, from /usr/local/include/opencv2/core/types_c.h:101, from /usr/include/opencv2/core/core.hpp:49, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/base.hpp:445:0: note: this is the location of the previous definition
define CVError( code, args ) cv::error( code, cv::format args, CV_Func, FILE, LINE )
^ In file included from opencv_mat.cpp:789:0: /usr/include/opencv2/core/core.hpp:223:0: warning: "CV_Assert" redefined
define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, CV_Func, FILE, LINE) )
^ In file included from /usr/local/include/opencv2/core.hpp:54:0, from /usr/local/include/opencv2/core/types_c.h:101, from /usr/include/opencv2/core/core.hpp:49, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/base.hpp:453:0: note: this is the location of the previous definition
define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, FILE, LINE ); } while(0)
^ In file included from /usr/include/opencv2/core/core.hpp:49:0, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/core_c.h:97:1: error: ‘IplImage’ does not name a type CVAPI(IplImage) cvCreateImageHeader( CvSize size, int depth, int channels ); ^ /usr/local/include/opencv2/core/core_c.h:109:1: error: ‘IplImage’ does not name a type CVAPI(IplImage) cvInitImageHeader( IplImage image, CvSize size, int depth, ^ /usr/local/include/opencv2/core/core_c.h:125:1: error: ‘IplImage’ does not name a type CVAPI(IplImage) cvCreateImage( CvSize size, int depth, int channels ); ^ In file included from /usr/local/include/opencv2/core/utility.hpp:1271:0, from /usr/local/include/opencv2/core.hpp:3280, from /usr/local/include/opencv2/core/types_c.h:101, from /usr/include/opencv2/core/core.hpp:49, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/core_c.h:140:36: error: variable or field ‘cvReleaseImageHeader’ declared void CVAPI(void) cvReleaseImageHeader( IplImage image ); ^ /usr/local/include/opencv2/core/core_c.h:140:36: error: ‘IplImage’ was not declared in this scope /usr/local/include/opencv2/core/core_c.h:140:47: error: ‘image’ was not declared in this scope CVAPI(void) cvReleaseImageHeader( IplImage image ); ^ /usr/local/include/opencv2/core/core_c.h:154:30: error: variable or field ‘cvReleaseImage’ declared void CVAPI(void) cvReleaseImage( IplImage image ); ^ /usr/local/include/opencv2/core/core_c.h:154:30: error: ‘IplImage’ was not declared in this scope /usr/local/include/opencv2/core/core_c.h:154:41: error: ‘image’ was not declared in this scope CVAPI(void) cvReleaseImage( IplImage image ); ^ In file included from /usr/include/opencv2/core/core.hpp:49:0, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/core_c.h:157:1: error: ‘IplImage’ does not name a type CVAPI(IplImage) cvCloneImage( const IplImage image ); ^ In file included from /usr/local/include/opencv2/core/utility.hpp:1271:0, from /usr/local/include/opencv2/core.hpp:3280, from /usr/local/include/opencv2/core/types_c.h:101, from /usr/include/opencv2/core/core.hpp:49, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/core_c.h:169:29: error: variable or field ‘cvSetImageCOI’ declared void CVAPI(void) cvSetImageCOI( IplImage image, int coi ); ^ /usr/local/include/opencv2/core/core_c.h:169:29: error: ‘IplImage’ was not declared in this scope /usr/local/include/opencv2/core/core_c.h:169:39: error: ‘image’ was not declared in this scope CVAPI(void) cvSetImageCOI( IplImage image, int coi ); ^ /usr/local/include/opencv2/core/core_c.h:169:46: error: expected primary-expression before ‘int’ CVAPI(void) cvSetImageCOI( IplImage image, int coi ); ^ /usr/local/include/opencv2/core/core_c.h:177:34: error: ‘IplImage’ does not name a type CVAPI(int) cvGetImageCOI( const IplImage image ); ^ /usr/local/include/opencv2/core/core_c.h:190:29: error: variable or field ‘cvSetImageROI’ declared void CVAPI(void) cvSetImageROI( IplImage image, CvRect rect ); ^ /usr/local/include/opencv2/core/core_c.h:190:29: error: ‘IplImage’ was not declared in this scope /usr/local/include/opencv2/core/core_c.h:190:39: error: ‘image’ was not declared in this scope CVAPI(void) cvSetImageROI( IplImage image, CvRect rect ); ^ /usr/local/include/opencv2/core/core_c.h:190:46: error: ‘CvRect’ was not declared in this scope CVAPI(void) cvSetImageROI( IplImage image, CvRect rect ); ^ /usr/local/include/opencv2/core/core_c.h:201:31: error: variable or field ‘cvResetImageROI’ declared void CVAPI(void) cvResetImageROI( IplImage image ); ^ /usr/local/include/opencv2/core/core_c.h:201:31: error: ‘IplImage’ was not declared in this scope /usr/local/include/opencv2/core/core_c.h:201:41: error: ‘image’ was not declared in this scope CVAPI(void) cvResetImageROI( IplImage image ); ^ In file included from /usr/include/opencv2/core/core.hpp:49:0, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/core_c.h:208:1: error: ‘CvRect’ does not name a type CVAPI(CvRect) cvGetImageROI( const IplImage image ); ^ In file included from /usr/local/include/opencv2/core/utility.hpp:1271:0, from /usr/local/include/opencv2/core.hpp:3280, from /usr/local/include/opencv2/core/types_c.h:101, from /usr/include/opencv2/core/core.hpp:49, from opencv_mat.cpp:789: /usr/local/include/opencv2/core/core_c.h:298:32: error: variable or field ‘cvDecRefData’ declared void CV_INLINE void cvDecRefData( CvArr arr ) ^ /usr/local/include/opencv2/core/core_c.h:298:32: error: ‘CvArr’ was not declared in this scope /usr/local/include/opencv2/core/core_c.h:298:39: error: ‘arr’ was not declared in this scope CV_INLINE void cvDecRefData( CvArr arr ) ^ In file included from opencv_mat.cpp:793:0: /usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line /usr/include/c++/5/typeinfo:39:37: error: expected declaration before end of line error: command 'gcc' failed with exit status 1
ERROR: Failed building wheel for opencv-mat Running setup.py clean for opencv-mat Failed to build opencv-mat Installing collected packages: opencv-mat, instaboost Running setup.py install for opencv-mat ... error ERROR: Complete output from command /opt/conda/envs/maskrcnn/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-qqkxalw5/opencv-mat/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-p1y930co/install-record.txt --single-version-externally-managed --compile: ERROR: running install running build running build_ext building 'opencv_mat' extension creating build creating build/temp.linux-x86_64-3.7 gcc -pthread -B /opt/conda/envs/maskrcnn/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include -I/usr/include/opencv2 -I/opt/conda/envs/maskrcnn/include/python3.7m -c opencv_mat.cpp -o build/temp.linux-x86_64-3.7/opencv_mat.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0, from /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12, from /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from opencv_mat.cpp:787: /opt/conda/envs/maskrcnn/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
warning "Using deprecated NumPy API, disable it with " \
ERROR: Command "/opt/conda/envs/maskrcnn/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-qqkxalw5/opencv-mat/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-p1y930co/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-qqkxalw5/opencv-mat/