w-okada / voice-changer

リアルタイムボイスチェンジャー Realtime Voice Changer
Other
16.1k stars 1.75k forks source link

[ISSUE]: ModuleNotFoundError: No module named 'fairseq' #1203

Open Hogel1888 opened 4 months ago

Hogel1888 commented 4 months ago

Voice Changer Version

v.1.5.3.18a

Operational System

Ubuntu 22.04

GPU

None

Read carefully and check the options

Model Type

RVC

Issue Description

Got the ModuleNotFoundError: No module named 'fairseq' in version v.1.5.3.18a

Occurs when selecting any model in GUI right after opening GUI in a browser.

Basically followed the manual on a freshly installed Ubuntu 22.04.

Found somewhat similar issue with the older version.

Application Screenshot

No response

Logs on console

Voice Changer] model slot is changed -1 -> 0 ................RVC [Voice Changer] post_update_settings ex: No module named 'fairseq' Traceback (most recent call last): File "/home/USER/voice-changer/server/restapi/MMVC_Rest_Fileuploader.py", line 71, in post_update_settings info = self.voiceChangerManager.update_settings(key, val) File "/home/USER/voice-changer/server/voice_changer/VoiceChangerManager.py", line 348, in update_settings self.generateVoiceChanger(newVal) File "/home/USER/voice-changer/server/voice_changer/VoiceChangerManager.py", line 256, in generateVoiceChanger from voice_changer.RVC.RVCr2 import RVCr2 File "/home/USER/voice-changer/server/voice_changer/RVC/RVCr2.py", line 12, in from voice_changer.RVC.embedder.EmbedderManager import EmbedderManager File "/home/USER/voice-changer/server/voice_changer/RVC/embedder/EmbedderManager.py", line 5, in from voice_changer.RVC.embedder.FairseqContentvec import FairseqContentvec File "/home/USER/voice-changer/server/voice_changer/RVC/embedder/FairseqContentvec.py", line 3, in from voice_changer.RVC.embedder.FairseqHubert import FairseqHubert File "/home/USER/voice-changer/server/voice_changer/RVC/embedder/FairseqHubert.py", line 4, in from fairseq import checkpoint_utils ModuleNotFoundError: No module named 'fairseq'

icecoins commented 3 months ago

plz try run this command in terminate:

pip install fairseq

and run app again

orangesandblast commented 3 months ago

I get the same error on Gentoo Linux using an AMD GPU, so maybe I can assist. It should be noted that the error message doesn't happen immediately, but rather when I attempt to load one of the sample models (at which point the GUI crashes with a "TypeError: Cannot read properties of null (reading 'modelSlots')" error which I commented on in another issue.

After installing fairseq, the error message changes to requiring pyworld:

    Booting PHASE :__main__
    PYTHON:3.10.9 (main, Mar  8 2023, 10:47:38) [GCC 11.2.0]
    Activating the Voice Changer.
[Voice Changer] download sample catalog. samples_0004_t.json
[Voice Changer] download sample catalog. samples_0004_o.json
[Voice Changer] download sample catalog. samples_0004_d.json
[Voice Changer] model_dir is already exists. skip download samples.
    Internal_Port:18888
    protocol: HTTPS(self-signed), key:keys/20240609_184555.key, cert:keys/20240609_184555.cert
    -- ---- -- 
    Please open the following URL in your browser.
    https://<IP>:<PORT>/
    In many cases, it will launch when you access any of the following URLs.
    https://localhost:18888/
    https://10.0.0.38:18888/
    Booting PHASE :__mp_main__
    The server process is starting up.
    Booting PHASE :MMVCServerSIO
[Voice Changer] VoiceChangerManager initializing...
[Voice Changer] VoiceChangerManager initializing... done.
[Voice Changer] MMVC_Rest initializing...
[Voice Changer] MMVC_Rest initializing... done.
[Voice Changer] MMVC_SocketIOApp initializing...
[Voice Changer] MMVC_SocketIOApp initializing... done.
[2024-06-09 18:46:05] connet sid : -mCVv_kQ0TFBhngTAAAC
[2024-06-09 18:46:05] connet sid : PKMWN5iyeOY-UbaGAAAD
[Voice Changer] update configuration: gpu 0
[Voice Changer] update configuration: modelSlotIndex 1717973175000
[Voice Changer] model slot is changed -1 -> 0
................RVC
[Voice Changer] post_update_settings ex: No module named 'pyworld'
Traceback (most recent call last):
  File "/hdde/voice/voice-changer/server/restapi/MMVC_Rest_Fileuploader.py", line 71, in post_update_settings
    info = self.voiceChangerManager.update_settings(key, val)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 348, in update_settings
    self.generateVoiceChanger(newVal)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 256, in generateVoiceChanger
    from voice_changer.RVC.RVCr2 import RVCr2
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/RVCr2.py", line 21, in <module>
    from voice_changer.RVC.pitchExtractor.PitchExtractorManager import PitchExtractorManager
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/pitchExtractor/PitchExtractorManager.py", line 4, in <module>
    from voice_changer.RVC.pitchExtractor.DioPitchExtractor import DioPitchExtractor
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/pitchExtractor/DioPitchExtractor.py", line 1, in <module>
    import pyworld
ModuleNotFoundError: No module named 'pyworld'

And after installing pyworld, it changes to looking for "libtorch_cuda.so". I'm not sure what package to install to fix this, but after doing some research it seems like it might come with nvidia pytorch packages. Since I am using AMD (rocm) packages, this seems like it shouldn't be required? I can't tell if it's these fairseq/pyworld/libtorch_cuda absences that are causing the crash, or if this is a separate thing from the modelSlots error.

    Booting PHASE :__main__
    PYTHON:3.10.9 (main, Mar  8 2023, 10:47:38) [GCC 11.2.0]
    Activating the Voice Changer.
[Voice Changer] download sample catalog. samples_0004_t.json
[Voice Changer] download sample catalog. samples_0004_o.json
[Voice Changer] download sample catalog. samples_0004_d.json
[Voice Changer] model_dir is already exists. skip download samples.
    Internal_Port:18888
    protocol: HTTPS(self-signed), key:keys/20240609_184655.key, cert:keys/20240609_184655.cert
    -- ---- -- 
    Please open the following URL in your browser.
    https://<IP>:<PORT>/
    In many cases, it will launch when you access any of the following URLs.
    https://localhost:18888/
    https://10.0.0.38:18888/
    Booting PHASE :__mp_main__
    The server process is starting up.
    Booting PHASE :MMVCServerSIO
[Voice Changer] VoiceChangerManager initializing...
[Voice Changer] VoiceChangerManager initializing... done.
[Voice Changer] MMVC_Rest initializing...
[Voice Changer] MMVC_Rest initializing... done.
[Voice Changer] MMVC_SocketIOApp initializing...
[Voice Changer] MMVC_SocketIOApp initializing... done.
[2024-06-09 18:47:06] connet sid : o1AoaLZpt4ff28aKAAAC
[2024-06-09 18:47:06] connet sid : sOdqNWkjp0osVlSgAAAD
[Voice Changer] update configuration: gpu 0
[Voice Changer] update configuration: modelSlotIndex 1717973233000
[Voice Changer] model slot is changed -1 -> 0
................RVC
[Voice Changer] post_update_settings ex: libtorch_cuda.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/hdde/voice/voice-changer/server/restapi/MMVC_Rest_Fileuploader.py", line 71, in post_update_settings
    info = self.voiceChangerManager.update_settings(key, val)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 348, in update_settings
    self.generateVoiceChanger(newVal)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 256, in generateVoiceChanger
    from voice_changer.RVC.RVCr2 import RVCr2
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/RVCr2.py", line 21, in <module>
    from voice_changer.RVC.pitchExtractor.PitchExtractorManager import PitchExtractorManager
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/pitchExtractor/PitchExtractorManager.py", line 11, in <module>
    from voice_changer.RVC.pitchExtractor.FcpePitchExtractor import FcpePitchExtractor
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/pitchExtractor/FcpePitchExtractor.py", line 5, in <module>
    import torchfcpe
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torchfcpe/__init__.py", line 1, in <module>
    from .tools import (
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torchfcpe/tools.py", line 2, in <module>
    from .mel_extractor import Wav2Mel
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torchfcpe/mel_extractor.py", line 5, in <module>
    from torchaudio.transforms import Resample
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torchaudio/__init__.py", line 1, in <module>
    from torchaudio import (  # noqa: F401
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torchaudio/_extension/__init__.py", line 43, in <module>
    _load_lib("libtorchaudio")
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torchaudio/_extension/utils.py", line 61, in _load_lib
    torch.ops.load_library(path)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/torch/_ops.py", line 643, in load_library
    ctypes.CDLL(path)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libtorch_cuda.so: cannot open shared object file: No such file or directory
orangesandblast commented 3 months ago

After temporarily resolving a different issue by reverting the git repository to a previous commit, this problem also disappeared.

My assumption is that these libraries are normally not required on my system and are only pulled in by the code that runs after an error occurs, but it is just an assumption. If that's true, it doesn't seem like a major problem but does still seem to represent undesired behavior because it was masking the real problem.