Closed tunazhao closed 7 years ago
Dear @tunazhao
please make sure that you have installed opencv with the --with-python3
flag:
brew install opencv3 --with-eigen --with-qt --with-ffmpeg --with-opencl --HEAD --with-contrib --with-python3 --force
If this is already the case and it still does not work try the following:
pip3 install opencv-python
Thank you @papr
pip3 install opencv-python
This works at last
Actually, I just learned that this does not solve the problem as expected. These bindings come with their own version of opencv and do actually not bind to the library that the instructions tell you to install.
This might lead to errors (e.g. #620 might be a candidate...) that are difficult to debug since you would run a different opencv version as we do.
To deinstall the wrong bindings, please run pip3 uninstall opencv-python
Yes, I uninstalled opencv-python
and reinstalled opencv3.
When installing opencv3, some tags are not available
--with-eigen --with-qt --with-opencl
I checked these tags are default installing, you can only install --without-eigen --without-opencl
And as for --with-qt
, there is only --with-qt5
However, after those steps, this problem still exists:
No module named 'cv2'
@tunazhao Thanks for the update.
As you note, it appears that the flags brew opencv3
's formula have changed since docs were written. Notes below:
--with-eigen
appears to no longer be a option flag as eigen
is listed as Recommended
in the formula--with-qt
appears to be updated to --with-qt5
--with-opencl
appears to be required by default so no need for the flag I believe that you need to follow the brew caveats at the end of the install process in order to properly link the lib.
For example:
echo /usr/local/opt/opencv3/lib/python3.6/site-packages >> /usr/local/lib/python3.6/site-packages/opencv3.pth
Dear @tunazhao
did you follow Caveats
advise by @willpatera that is also noted in the wiki and at the end of the homebrew opencv3 installation? Did it solve your problem?
If not, could you run locate cv2
in your Terminal app?
Thank you @willpatera & @papr
I have followed the Caveats to link the lib, however, I fount out thatpython3.6 folder
doesn't exist in the routine /usr/local/opt/opencv3/lib/
And when I try to find cv2
in my computer, it doesn't exist as well
I have reinstalled opencv3 and the problem stays the same
What is your output for ls /usr/local/opt/opencv3/lib/
?
Having the same issues. My output for ls /usr/local/opt/opencv3/lib/
is
NYtGand272902:~ tgand2$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist /System/Library/LaunchDaemons/com.apple.locate.plist: service already loaded NYtGand272902:~ tgand2$ echo /usr/local/opt/opencv3/lib/python3.6/site-packages >> /usr/local/lib/python3.6/site-packages/opencv3.pth NYtGand272902:~ tgand2$ ls /usr/local/opt/opencv3/lib/ libopencv_aruco.3.2.0.dylib libopencv_phase_unwrapping.dylib libopencv_aruco.3.2.dylib libopencv_photo.3.2.0.dylib libopencv_aruco.dylib libopencv_photo.3.2.dylib libopencv_bgsegm.3.2.0.dylib libopencv_photo.dylib libopencv_bgsegm.3.2.dylib libopencv_plot.3.2.0.dylib libopencv_bgsegm.dylib libopencv_plot.3.2.dylib libopencv_bioinspired.3.2.0.dylib libopencv_plot.dylib libopencv_bioinspired.3.2.dylib libopencv_reg.3.2.0.dylib libopencv_bioinspired.dylib libopencv_reg.3.2.dylib libopencv_calib3d.3.2.0.dylib libopencv_reg.dylib libopencv_calib3d.3.2.dylib libopencv_rgbd.3.2.0.dylib libopencv_calib3d.dylib libopencv_rgbd.3.2.dylib libopencv_ccalib.3.2.0.dylib libopencv_rgbd.dylib libopencv_ccalib.3.2.dylib libopencv_saliency.3.2.0.dylib libopencv_ccalib.dylib libopencv_saliency.3.2.dylib libopencv_core.3.2.0.dylib libopencv_saliency.dylib libopencv_core.3.2.dylib libopencv_shape.3.2.0.dylib libopencv_core.dylib libopencv_shape.3.2.dylib libopencv_datasets.3.2.0.dylib libopencv_shape.dylib libopencv_datasets.3.2.dylib libopencv_stereo.3.2.0.dylib libopencv_datasets.dylib libopencv_stereo.3.2.dylib libopencv_dnn.3.2.0.dylib libopencv_stereo.dylib libopencv_dnn.3.2.dylib libopencv_stitching.3.2.0.dylib libopencv_dnn.dylib libopencv_stitching.3.2.dylib libopencv_dpm.3.2.0.dylib libopencv_stitching.dylib libopencv_dpm.3.2.dylib libopencv_structured_light.3.2.0.dylib libopencv_dpm.dylib libopencv_structured_light.3.2.dylib libopencv_face.3.2.0.dylib libopencv_structured_light.dylib libopencv_face.3.2.dylib libopencv_superres.3.2.0.dylib libopencv_face.dylib libopencv_superres.3.2.dylib libopencv_features2d.3.2.0.dylib libopencv_superres.dylib libopencv_features2d.3.2.dylib libopencv_surface_matching.3.2.0.dylib libopencv_features2d.dylib libopencv_surface_matching.3.2.dylib libopencv_flann.3.2.0.dylib libopencv_surface_matching.dylib libopencv_flann.3.2.dylib libopencv_text.3.2.0.dylib libopencv_flann.dylib libopencv_text.3.2.dylib libopencv_fuzzy.3.2.0.dylib libopencv_text.dylib libopencv_fuzzy.3.2.dylib libopencv_tracking.3.2.0.dylib libopencv_fuzzy.dylib libopencv_tracking.3.2.dylib libopencv_highgui.3.2.0.dylib libopencv_tracking.dylib libopencv_highgui.3.2.dylib libopencv_video.3.2.0.dylib libopencv_highgui.dylib libopencv_video.3.2.dylib libopencv_imgcodecs.3.2.0.dylib libopencv_video.dylib libopencv_imgcodecs.3.2.dylib libopencv_videoio.3.2.0.dylib libopencv_imgcodecs.dylib libopencv_videoio.3.2.dylib libopencv_imgproc.3.2.0.dylib libopencv_videoio.dylib libopencv_imgproc.3.2.dylib libopencv_videostab.3.2.0.dylib libopencv_imgproc.dylib libopencv_videostab.3.2.dylib libopencv_line_descriptor.3.2.0.dylib libopencv_videostab.dylib libopencv_line_descriptor.3.2.dylib libopencv_xfeatures2d.3.2.0.dylib libopencv_line_descriptor.dylib libopencv_xfeatures2d.3.2.dylib libopencv_ml.3.2.0.dylib libopencv_xfeatures2d.dylib libopencv_ml.3.2.dylib libopencv_ximgproc.3.2.0.dylib libopencv_ml.dylib libopencv_ximgproc.3.2.dylib libopencv_objdetect.3.2.0.dylib libopencv_ximgproc.dylib libopencv_objdetect.3.2.dylib libopencv_xobjdetect.3.2.0.dylib libopencv_objdetect.dylib libopencv_xobjdetect.3.2.dylib libopencv_optflow.3.2.0.dylib libopencv_xobjdetect.dylib libopencv_optflow.3.2.dylib libopencv_xphoto.3.2.0.dylib libopencv_optflow.dylib libopencv_xphoto.3.2.dylib libopencv_phase_unwrapping.3.2.0.dylib libopencv_xphoto.dylib libopencv_phase_unwrapping.3.2.dylib pkgconfig
This is a user specific problem. I have rerun the mac os dependencies setup multiple times without any problems.
I have followed all the instructions to install the packages. When I run the main.py program with python3, the error says,
File "/Users/Zhao/Documents/pupil_lab/pupil/pupil_src/shared_modules/methods.py", line 19, in
import cv2
ModuleNotFoundError: No module named 'cv2'
I tried a lot of ways to solve the cv2 problem but none of them worked. Could you please help me with this?