Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'cv2' #73

Closed
raj6996 opened this issue Sep 1, 2018 · 8 comments

Comments

@raj6996
Copy link

commented Sep 1, 2018

Bug/Issue Description:
G:\PySceneDetect-0.5>scenedetect -i "G:\I2\I.mp4" detect-content list-scenes split-video --copy
Traceback (most recent call last):
File "G:\PySceneDetect-0.5\scenedetect.py", line 34, in
from scenedetect.main import main
File "G:\PySceneDetect-0.5\scenedetect_init_.py", line 52, in
from scenedetect.scene_manager import SceneManager
File "G:\PySceneDetect-0.5\scenedetect\scene_manager.py", line 55, in
import cv2
ModuleNotFoundError: No module named 'cv2'
G:\PySceneDetect-0.5>

Computing Environment:

  • OS: Windows 10 Pro
  • Python Version: 3.7.0 32bit
  • OpenCV Version: Don't know, don't install this.

Additional Information:
I downloaded source code zip file, after extracting I run setup file. I don't install opencv cause I don't have any issue with previous issue as I did same way.

Media [Videos/Images/Screenshots]:
MP4 file

Remove this section if there is no media associated with the issue/bug report.

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Sep 1, 2018

Hi @raj6996;

You need to install the opencv-python module via:

pip install opencv-python

Also note you can install PySceneDetect the same way via:

pip install scenedetect

If the above methods fail, you can also download the cv2 module from:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

For 32-bit Python 3.7, you want the file opencv_python‑3.4.3‑cp37‑cp37m‑win32.whl, and install it via pip (e.g. pip install [file]). Also note that you can install PySceneDetect via pip now (e.g. pip install scenedetect).

I'll try to have a more descriptive error message in the program in the next release, thanks for bringing this up. Let me know if you have any issues getting OpenCV installed.


Edit: I didn't add OpenCV as a dependency to the setup.py file because the opencv-python package used to not include static libraries, but it seems to now. The next release of PySceneDetect (v0.6) will include this fix, so it installs cleanly when you run:

pip install scenedetect
@raj6996

This comment has been minimized.

Copy link
Author

commented Sep 2, 2018

After installing with "pip install opencv-python" command, I got this:

Error: Invalid value for split-video: mkvmerge is required for split-video -c/--copy.
Install the above tool to enable video splitting support.

Then I recalled you told to use MKVmerge.exe on scenedetect folder, so I used portable and copy MKVmerge.exe and it works flawlessly.
by the way, how to use ffmpeg with scenedetect. kindly reply me step by step for being total noob on programing field. thanks.

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Sep 2, 2018

Hi @raj6996;

You can get both ffmpeg/mkvmerge from here for 64-bit Windows:
https://github.com/Breakthrough/PySceneDetect/blob/resources/third-party/split-video-progams-win64.7z?raw=true

Likewise, you do the same thing (just drop ffmpeg.exe where scenedetect.exe is). I'll try to make the download link a little bit more apparent, and when I finalize the Windows release (portable/installer), it should include both programs for you as well.

If you have 32-bit Windows, you can find download links for ffmpeg/mkvmerge from:
https://pyscenedetect.readthedocs.io/en/latest/examples/video-splitting/

Let me know if this solves it, thanks again for your help in testing the software!!

@raj6996

This comment has been minimized.

Copy link
Author

commented Sep 9, 2018

I recently used 64bit python. so don't know why this I got error!
C:\Python37\Lib\site-packages\scenedetect>pip install scenedetect
Requirement already satisfied: scenedetect in c:\python37\lib\site-packages (0.5)
Requirement already satisfied: Click in c:\python37\lib\site-packages (from scenedetect) (6.7)
Requirement already satisfied: numpy in c:\python37\lib\site-packages (from scenedetect) (1.15.1)

Here is error:
C:\Python37\Lib\site-packages\scenedetect>scenedetect -i "G:\MGPM\MM2018.mp4" -o "G:\MGPM\A" detect-content list-scenes split-video --copy
Traceback (most recent call last):
File "c:\python37\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python37\Scripts\scenedetect.exe_main
.py", line 5, in
File "c:\python37\lib\site-packages\scenedetect_init
.py", line 52, in
from scenedetect.scene_manager import SceneManager
File "c:\python37\lib\site-packages\scenedetect\scene_manager.py", line 55, in
import cv2
ModuleNotFoundError: No module named 'cv2'

C:\Python37\Lib\site-packages\scenedetect>

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Sep 10, 2018

@raj6996;

You need to pip install opencv-python as above again.

@raj6996

This comment has been minimized.

Copy link
Author

commented Sep 10, 2018

Thanks Breakthrough, awesome and fast support!

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Jul 20, 2019

Fixed in 6c4c8d4.

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2019

Original fix caused new bug (captured by #111).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.