AttributeError: 'module' object has no attribute 'face' OS X
I'm trying to build opencv with opencv_contrib on OS X. I will explain step-by-step what I did:
- I downloaded the OpenCV 3.1 from: http://opencv.org/downloads.html
- I also downloaded the opencv_contribfrom: https://github.com/Itseez/opencv_contrib
- I put the opencv_contrib folder inside the opencv-3.1.0 folder
- I created a folder called "build" inside the opencv-3.1.0 folder
- From the terminal I went to the build folder:
/Users/kelvinsp/Downloads/opencv-3.1.0/build/
Then I ran the following commands:
cmake -DOPENCV_EXTRA_MODULES_PATH=/Users/kelvinsp/Downloads/opencv-3.1.0/opencv_contrib/modules /Users/kelvinsp/Downloads/opencv-3.1.0/
make -j5
sudo make install
Then, in the python terminal I tried to run the command:
import cv2
and receive the following error:ImportError: No module named cv2
- Searching in stackoverflow, I found a solution and I ran the command:
export PYTHONPATH=/usr/local/lib/python2.7/site-packages/:$PYTHONPATH
- Now the import cv2 command is working, but when I ran the command
help(cv2.face)
I got the following error:AttributeError: 'module' object has no attribute 'face'
Can someone help me please? I don't know what I'm doing wrong.
cmake output:
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- The C compiler identification is AppleClang 7.3.0.7030031
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
-- Performing Test HAVE_C_FSIGNED_CHAR
-- Performing Test HAVE_C_FSIGNED_CHAR - Success
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_C_W
-- Performing Test HAVE_C_W - Success
-- Performing Test HAVE_CXX_WALL
-- Performing Test HAVE_CXX_WALL - Failed
-- Performing Test HAVE_C_WALL
-- Performing Test HAVE_C_WALL - Failed
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_C_WERROR_RETURN_TYPE
-- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_CXX_WERROR_ADDRESS
-- Performing Test HAVE_CXX_WERROR_ADDRESS - Success
-- Performing Test HAVE_C_WERROR_ADDRESS
-- Performing Test HAVE_C_WERROR_ADDRESS - Success
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_CXX_WFORMAT
-- Performing Test HAVE_CXX_WFORMAT - Success
-- Performing Test HAVE_C_WFORMAT
-- Performing Test HAVE_C_WFORMAT - Success
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_C_WMISSING_DECLARATIONS
-- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_C_WMISSING_PROTOTYPES
-- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WUNDEF
-- Performing Test HAVE_CXX_WUNDEF - Success
-- Performing Test HAVE_C_WUNDEF
-- Performing ...
can you show us the cmake output ? (append it to your question)
3.:I put the opencv_contrib folder inside the opencv-3.1.0 folder
rather put it next to your opencv-3.1.0 folder
Thanks @berak.
I rebuild the opencv with the opencv_contrib folder next to the opencv folder (not inside), but still not working.
I updated the question with the cmake output link.
Yesterday I also tried to use the following cmake command to build:
but it didn't work.
"but it didn't work." -- please never say that again.
Sorry for ask that, but why never say "but it didn't work."? My english is not so good, but in portuguese it's normal to say that. In my mind, it means that I built everything with this command but I got the same error message.
help(cv2.fuzzy) help(cv2.plot) help(cv2.text)
and got the same error:AttributeError: 'module' object has no attribute '...'
apologies, never meant to offend you in any way, - usually, it sounds more like whining, but please let's drop the whole thing.
ando, not a dropbox or any external thing, please really just edit your question again, and append the cmake output there. very likely we'll find some explanation in there !
also, did you have a previous cv2.pyd installed ?
cv2.__version__
would tell, if you're using the right one.No problem, you don't offended me, I just wanted to understand to not do it again, but ok I understood your point.
I put the entire cmake output in the question.
I ran the command
c2.__version__
and I got this output'3.0.0'
. Apparently I have an older version in somewhere.