myshell-ai / OpenVoice

Instant voice cloning by MIT and MyShell.
https://research.myshell.ai/open-voice
MIT License
29.88k stars 2.94k forks source link

FileNotFoundError: [WinError 2] The system cannot find the file specified #316

Open doenertrinker909 opened 1 month ago

doenertrinker909 commented 1 month ago

I'm trying to run the first demo but when I try running this command:

reference_speaker = 'resources/example_reference.mp3' # This is the voice you want to clone
target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, target_dir='processed', vad=True) 

I get the error. I tried using the full path to the file or putting it somewhere else and I installed ffmpeg, added it to the System Environment Variables and installed it in the python environment.

OpenVoice version: v1
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[5], [line 2](vscode-notebook-cell:?execution_count=5&line=2)
      [1](vscode-notebook-cell:?execution_count=5&line=1) reference_speaker = 'resources/example_reference.mp3' # This is the voice you want to clone
----> [2](vscode-notebook-cell:?execution_count=5&line=2) target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, target_dir='processed', vad=True)

File c:\Users\jonas\OneDrive\Desktop\Main\open voice\OpenVoice\openvoice\se_extractor.py:145, in get_se(audio_path, vc_model, target_dir, vad)
    [143](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:143) if vad:
    [144](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:144)     wavs_folder = split_audio_vad(audio_path, target_dir=target_dir, audio_name=audio_name)
--> [145](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:145) else:
    [146](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:146)     wavs_folder = split_audio_whisper(audio_path, target_dir=target_dir, audio_name=audio_name)
    [148](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:148) audio_segs = glob(f'{wavs_folder}/*.wav')

File c:\Users\jonas\OneDrive\Desktop\Main\open voice\OpenVoice\openvoice\se_extractor.py:80, in split_audio_vad(audio_path, audio_name, target_dir, split_seconds)
     [78](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:78) SAMPLE_RATE = 16000
     [79](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:79) audio_vad = get_audio_tensor(audio_path)
---> [80](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:80) segments = get_vad_segments(
     [81](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:81)     audio_vad,
     [82](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:82)     output_sample=True,
     [83](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:83)     min_speech_duration=0.1,
     [84](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:84)     min_silence_duration=1,
     [85](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:85)     method="silero",
     [86](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:86) )
     [87](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:87) segments = [(seg["start"], seg["end"]) for seg in segments]
     [88](file:///C:/Users/jonas/OneDrive/Desktop/Main/open%20voice/OpenVoice/openvoice/se_extractor.py:88) segments = [(float(s) / SAMPLE_RATE, float(e) / SAMPLE_RATE) for s,e in segments]
...
   [1435](file:///C:/Program%20Files/WindowsApps/PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0/lib/subprocess.py:1435)     self._close_pipe_fds(p2cread, p2cwrite,
   [1436](file:///C:/Program%20Files/WindowsApps/PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0/lib/subprocess.py:1436)                          c2pread, c2pwrite,
   [1437](file:///C:/Program%20Files/WindowsApps/PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0/lib/subprocess.py:1437)                          errread, errwrite)

FileNotFoundError: [WinError 2] The system cannot find the file specified
dosubot[bot] commented 1 month ago

Hey @doenertrinker909, I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together!

There are several similar issues related to the FileNotFoundError: [WinError 2] The system cannot find the file specified error in the OpenVoice repository. Here are some relevant discussions and their solutions:

  1. FileNotFoundError: [WinError 2] 系统找不到指定的文件 (Open):

    • Solution: Download ffmpeg, add ffmpeg.exe to the venv/scripts directory, and add the ffmpeg path (e.g., C:\Program Files\ffmpeg\bin) to your environment variables. Reboot Visual Studio Code.
  2. I have a File Error in demo_part1.ipynb (Open):

    • Solution: If using conda, run conda install ffmpeg. For a pip-only environment, extract the contents of the bin folder from a pre-compiled version of ffmpeg (e.g., ffmpeg-master-latest-win64-gpl-shared.zip) into the .venv\Scripts folder.
  3. FileNotFoundError: [WinError 2] The system cannot find the file specified (Closed):

    • Solution: Download FFMPEG and place it in the PATH (environment variable) of your system, then pip install python-ffmpeg into your environment. Follow the steps in this guide (note: instead of the 4th step, directly copy-paste the path of the ffmpeg file into the PATH).

Make sure you have followed these steps correctly. If the issue persists, double-check that the ffmpeg executable is accessible from your command line and that the environment variables are set correctly.

To continue talking to Dosu, mention @dosu.