Skip to content

ModuleNotFoundError: No module named 'cv2' #73

Closed

Description

@raj6996

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.

Activity

  1. Breakthrough commented on Sep 1, 2018

    @Breakthrough
    Owner

    Hi @raj6996;

    You need to install the opencv-python module via:

    pip install scenedetect[opencv]
    

    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. You can now just type the following to install both:

    pip install scenedetect[opencv]
    
  2. raj6996 commented on Sep 2, 2018

    @raj6996
    Author

    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.

  3. Breakthrough commented on Sep 2, 2018

    @Breakthrough
    Owner

    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!!

  4. raj6996 commented on Sep 9, 2018

    @raj6996
    Author

    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>

  5. Breakthrough commented on Sep 10, 2018

    @Breakthrough
    Owner

    @raj6996;

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

  6. raj6996 commented on Sep 10, 2018

    @raj6996
    Author

    Thanks Breakthrough, awesome and fast support!

  7. added this to the milestone on Jun 2, 2019
  8. modified the milestones: , v0.5.1 on Jul 13, 2019
  9. Breakthrough commented on Jul 20, 2019

    @Breakthrough
    Owner

    Fixed in 6c4c8d4.

  10. Breakthrough commented on Aug 4, 2019

    @Breakthrough
    Owner

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

  11. mrobe commented on Oct 17, 2019

    @mrobe

    I am getting this same error on macOS 10.13.6. Tried everything in this thread but no joy.

    What to do?

  12. hlgope commented on Dec 27, 2019

    @hlgope

    Thanks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions