tmoroney / auto-subs

Generate subtitles using OpenAI Whisper in Davinci Resolve editing software.
MIT License
479 stars 29 forks source link

No module named "stable-whisper" #12

Open danini1705 opened 9 months ago

danini1705 commented 9 months ago

I installed the script, but it seems that it doesn't work for me. Auto subs light works.

Traceback (most recent call last): File "", line 1, in NameError: name 'i' is not defined. Did you mean: 'id'? Traceback (most recent call last): File "/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Utility/auto-subs.py", line 1, in import stable_whisper ModuleNotFoundError: No module named 'stable_whisper'

I asked in the stable-whisper github but apparently they have no idea

danini1705 commented 9 months ago

I would love to have some more assistance, thanks! And happy new year!

tmoroney commented 8 months ago

Not sure what the issue is here. Try using the auto-install method I added to the documentation.

tmoroney commented 8 months ago

I'd recommend joining the discord if you are having issues.

Swift12gaming commented 7 months ago

im having the same problem

philexh commented 6 months ago

Changing the import to just "whisper" helped me fix the problem!

danini1705 commented 6 months ago

But whisper is a completely different Library hahaha I fixed it by reinstalling and reinstall python

On Tue, 19 Mar 2024, 15:11 philexh, @.***> wrote:

Changing the import to just "whisper" helped me fix the problem!

— Reply to this email directly, view it on GitHub https://github.com/tmoroney/auto-subs/issues/12#issuecomment-2007286967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYH3S365EOJ77WYUYJVV3LYZBBPPAVCNFSM6AAAAABAZMNPHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBXGI4DMOJWG4 . You are receiving this because you authored the thread.Message ID: @.***>

dextriminator commented 6 months ago

go the auto subs using the guide %PROGRAMDATA%\Blackmagic Design\DaVinci Resolve\Fusion\Scripts after opening the utility open the auto subs using the edit option and remove the "import stable_whisper" part of the script. it should start working

AHM3Mk commented 6 months ago

well it is going to show up but stop at "name 'stable_whisper' is not defined" and won't do anything after.

francqz31 commented 6 months ago

pip install stable-ts==1.1.1b0 should solve the problem ;)

AHM3Mk commented 6 months ago

well... I gave up yesterday and uninstalled everything and when I saw ur comment i tried again, but this time another error occurred 🫠 -> "Using model -> [ small.en ] list index out of range"

MoHAHAHA2 commented 5 months ago

open powershell type this pip install -U stable-ts boom fixed

MoHAHAHA2 commented 5 months ago

idk bout your second error but this is for the first erros so reinstall everything then do that if the error you first wrote came up again

Vq-x commented 5 months ago

I have found that it is due to multiple versions of python on your system. If your pip command is connected to another version of python then it is installing all of the packages else where, on my system I had both Python 3.10 and 3.12 so I uninstalled 3.10 and restarted my PC. I also reinstalled with the PowerShell command and it works.

cptsubtxt commented 5 months ago

If you encounter the problem in Mac OS X I did not find the solution, but one reason. When using a debug script like that presented at the end and put it into the same directory as the auto-subs.py and run it in DaVinci Resolve with console turned on you will get a more detailed error.

Regarding Mac OS X and Apple Silicon (M1, M2 etc.) the problem is that some packages are compiled for x86 and some compiled in ARM64. In my case numpy is the problem.

You can install arch specific packages when available like so:

pip3 uninstall numpy
arch -arm64 pip3 install numpy    

Numpy still has a problem, so no solution yet.

import logging
import os
import platform
import sys
logger = logging.getLogger()
logging.basicConfig(filename='/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Utility/log.log', level=logging.DEBUG)
logger.debug(str(os.__file__))

print("Python version") 
print (sys. version) 
print("Version info.") 
print (sys. version_info)
system = platform.system()
machine = platform.machine()
print("System the interpreter is running") 
print(system)
print("Architecture the interpreter is running") 
print(machine)

import stable_whisper
mangonerd commented 5 months ago

After hours of pulling my hair, I’ve found the solution!

  1. Go to the console inside DaVinci Resolve
  2. Enter import sys and then print(sys.version)
  3. Take note of the Python version that Resolve is using. We need to install stable-ts for that specific Python version. For me it was 3.10
  4. Install stable-ts in that version: python{your version number here} -m pip install stable-ts in my case it was python3.10 -m pip install stable-ts

Voilà! It should work now!

The problem is exactly what @Vq-x stated—having multiple Python versions and not being able to control which version resolve is using and where pip installs stuff by default. I’m not a programmer, so I assume there’s a more elegant solution to this mess. Maybe @tmoroney can integrate something in the script itself? ;)

Edit: That launched the script, but there were still issues. Ultimately, I decided to uninstall all versions of python installed through homebrew and reinstalled through the official installer on the website. Now the script works without any issues. However, the above solution may still work for you.

Mustafiz04 commented 3 months ago

Hi I am also getting this error ModuleNotFoundError: No module named 'stable_whisper' Can anyone please guide me to fix this error in MacOS?

Miacrocosm commented 3 months ago

I was able to fix mine on WIndows after making sure DaVinci and my system were using the same Python version. After some uninstalling and installing of Python, I did: pip3 install -U stable-ts, in my PowerShell, and it worked after already doing: pip3 install -U openai-whisper

GISBoost commented 2 months ago

I encountered the same problem with no module stable-whisper and solution that worked for me was:

  1. Uninstall python completely from your PC
  2. Restart PC
  3. Install python 3.11.6
  4. Install PyTorch.
  5. Install Choco 4.1 Install ffmpeg via choco with choco install ffmpeg
  6. Install whisper with pip install -U openai-whisper
  7. Completely uninstall DaVinci Resolve
  8. Restart PC
  9. Install DaVinci Resolve
  10. Install plugin via powershell Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/tmoroney/auto-subs/main/install-script.ps1").Content you will be prompted that basically almost everything is installed already

After this you should be good to go

rfkhwaja commented 2 months ago

^^ Tried this, did not work. The solution that worked for me was

pip uninstall numpy pip install numpy==1.26.4

chigoKawa commented 1 month ago

On Mac, what I found to work is to ensure the packages are all installed, e.g., whisper, stable-ts, etc.

`import sys

sys.path.append( "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages" )`

One other thing is to ensure the version of NumPy is accurate. Someone already mentioned downgrading NumPy; I had to do that as well.