Skip to content

Conversation

@haru2503
Copy link

@haru2503 haru2503 commented Apr 9, 2025

Pull request checklist

  • The PR has a proper title. Use Semantic Commit Messages.

  • Make sure this is ready to be merged into the relevant branch.

  • Ensure you can run the code you submitted successfully.

PR Type:

  • Bug fix

Description

  • This pull request fixes a ModuleNotFoundError when running training/preprocessing scripts using python -m ....

  • The error occurs because Python does not recognize certain subdirectories as packages unless they contain an init.py file.

Example error:

(venv) PS D:\rvc\Retrieval-based-Voice-Conversion-WebUI> python infer/modules/train/preprocess.py ../wav 44100 2 ../processed_data False 0.1
Traceback (most recent call last):
  File "infer/modules/train/preprocess.py", line 23, in <module>
    from infer.lib.audio import load_audio
ModuleNotFoundError: No module named 'infer.lib'

Or when using python -m:

(venv) PS D:\rvc\Retrieval-based-Voice-Conversion-WebUI> python -m infer.modules.train.preprocess
Error while finding module specification for 'infer.modules.train.preprocess' (ModuleNotFoundError: No module named 'infer.modules')

📦 What it affects:

  • Adds the missing __init__.py files in the following directories:
infer/__init__.py
infer/lib/__init__.py
infer/modules/__init__.py
infer/modules/train/__init__.py
  • This resolves import issues for infer.modules.train.* and improves out-of-the-box compatibility — especially for Windows users, IDE users, and people running scripts via -m.

Screenshot

  • Not applicable

@haru2503 haru2503 closed this by deleting the head repository Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant