jianfch / stable-ts

Transcription, forced alignment, and audio indexing with OpenAI's Whisper
MIT License
1.59k stars 176 forks source link

ModuleNotFoundError: No module named 'stable_whisper' #239

Open danini1705 opened 1 year ago

danini1705 commented 1 year ago

I am using a script from another developer that is using Stable-ts

After discussing the issue with the developer he is sadly not able to help. So here I am asking.

How can we fix this? I installed stable-ts and whisper, but apparently it doesn't work. I am using a script for davinci resolve

jianfch commented 1 year ago

Check if Stable-ts is in the environment with pip show stable-ts and make sure the script runs in the same environment. If you still get the error, try to reinstall Stable-ts, pip install --upgrade --no-deps --force-reinstall stable-ts, or install it in a new environment.

danini1705 commented 1 year ago

I tried both Here is my output

Name: stable-ts Version: 2.13.1 Summary: Modifies OpenAI's Whisper to produce more reliable timestamps. Home-page: https://github.com/jianfch/stable-ts Author: Jian Author-email: License: MIT Location: /opt/homebrew/lib/python3.11/site-packages Requires: ffmpeg-python, more-itertools, numpy, openai-whisper, torch, torchaudio, tqdm, transformers Required-by:

And when I run the script: 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'

Also, I reinstalled it like you said

jianfch commented 1 year ago

It is likely due the script not running the the same environment that Stable-ts was installed in.

jianfch commented 11 months ago

Have you tried starting davinci resolve from the command line?

danini1705 commented 11 months ago

You mean opening it via terminal?

On Tue, 12 Dec 2023, 20:38 jian, @.***> wrote:

Have you tried starting davinci resolve from the command line?

— Reply to this email directly, view it on GitHub https://github.com/jianfch/stable-ts/issues/239#issuecomment-1852687477, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYH3SZ6KUMYFJ6S4XF236DYJCXC3AVCNFSM6AAAAAA64NMR4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJSGY4DONBXG4 . You are receiving this because you authored the thread.Message ID: @.***>

jianfch commented 11 months ago

You mean opening it via terminal?

Yes

danini1705 commented 11 months ago

Even when opening it from the terminal, it sadly doesn’t work

From: jian @.> Date: Tuesday, 12. December 2023 at 22:09 To: jianfch/stable-ts @.> Cc: DNP @.>, Author @.> Subject: Re: [jianfch/stable-ts] ModuleNotFoundError: No module named 'stable_whisper' (Issue #239)

You mean opening it via terminal?

Yes

— Reply to this email directly, view it on GitHubhttps://github.com/jianfch/stable-ts/issues/239#issuecomment-1852814721, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYH3SZIBIUWZ47SB2O3W7DYJDBXBAVCNFSM6AAAAAA64NMR4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJSHAYTINZSGE. You are receiving this because you authored the thread.Message ID: @.***>

jianfch commented 11 months ago

You can try to install stable-ts in code by running these lines the python console within davinci resolve:

import sys
import subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'stable-ts'])

If you still get the error, try to restart the console or davinci resolve.

danini1705 commented 11 months ago

Still doesn't work

On Wed, 13 Dec 2023, 20:59 jian, @.***> wrote:

You can try to install stable-ts in code by running these lines the python console within davinci resolve:

import sysimport subprocesssubprocess.check_call([sys.executable, '-m', 'pip', 'install', 'stable-ts'])

If you still get the error, try to restart the console or davinci resolve.

— Reply to this email directly, view it on GitHub https://github.com/jianfch/stable-ts/issues/239#issuecomment-1854619418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYH3S2AH7ZZZZ4GEJCVJFLYJICLZAVCNFSM6AAAAAA64NMR4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJUGYYTSNBRHA . You are receiving this because you authored the thread.Message ID: @.***>

danini1705 commented 11 months ago

So I am the exception where nothing works? :D

danini1705 commented 10 months ago

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

ThisIsntTheWay commented 10 months ago

What is the version of your default python interpreter, i.e. what does python --version print?
I noticed that your pip show stable-ts command indicates that the package was installed into /opt/homebrew/lib/python3.11/site-packages.

I've had the same issue just now, and it was because I am actually using Python 3.9, yet pip was installing stuff into the site-packages for version 3.10. I fixed this by uninstalling the pip package from my distro and installing it manually using the get-pip.py script:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py
#     ^^^ Or whatever version you intend to install pip for

Afterwards, the packages got put into the right environment and I was able to use stable-ts.

danini1705 commented 10 months ago

I am using Python 3.11.6 :)

cptsubtxt commented 7 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
ParkerRex commented 1 month ago

make sure the davinci python executable has the right packages and path