abdeladim-s / subsai

🎞️ Subtitles generation tool (Web-UI + CLI + Python package) powered by OpenAI's Whisper and its variants 🎞️
https://abdeladim-s.github.io/subsai/
GNU General Public License v3.0
1.15k stars 96 forks source link

FileNotFoundError: [WinError 2] #95

Open lererledd opened 6 months ago

lererledd commented 6 months ago

Captura de pantalla 2024-01-02 040616 hello!!! I am Spanish and very beginner haha, I do not speak much English but I want to solve this problem, every time I upload something, and I hit "transcribe"; I get this: "FileNotFoundError: [WinError 2] The system can not find the specified file" although I upload it in upload or local path, how could I solve it, thanks in advance and sorry to bother

abdeladim-s commented 6 months ago

Hello @lererledd, No problem, your english is very good :sweat_smile:

Regarding the error, if you are running the project locally just use local path (from file mode) and provide the absolute path of your media file (not a relative path). If the absolute path does not work, please copy/paste the entire error so I can see clearly from where the problem is coming.

lererledd commented 6 months ago

imagen

I always get this error, in any of the models

entire error:

FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado Traceback:

File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 545, in run() File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 538, in run webui() File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 318, in webui subs = _transcribe(file_path, stt_model_name, model_config) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 194, in wrapper return cached_func(*args, *kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 223, in call return self._get_or_create_cached_value(args, kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 248, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 302, in _handle_cache_miss computed_value = self._info.func(func_args, **func_kwargs) File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 190, in _transcribe subs = subs_ai.transcribe(media_file=file_path, model=model) File "C:\Program Files\Python310\lib\site-packages\subsai\main.py", line 115, in transcribe return stt_model.transcribe(media_file) File "C:\Program Files\Python310\lib\site-packages\subsai\models\whisperX_model.py", line 130, in transcribe audio = whisperx.load_audio(media_file) File "C:\Users\juang\AppData\Roaming\Python\Python310\site-packages\whisperx\audio.py", line 46, in load_audio ffmpeg.input(file, threads=0) File "C:\Users\juang\AppData\Roaming\Python\Python310\site-packages\ffmpeg_run.py", line 313, in run process = run_async( File "C:\Users\juang\AppData\Roaming\Python\Python310\site-packages\ffmpeg_run.py", line 284, in run_async return subprocess.Popen( File "C:\Program Files\Python310\lib\subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\Python310\lib\subprocess.py", line 1440, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

abdeladim-s commented 6 months ago

@lererledd, You didn't copy the entire error. There should be something after this hp, ht, pid, tid = _winapi.CreateProcess(executable, args, You can take a look at the terminal window and copy it from there.

lererledd commented 6 months ago

@abdeladim-s

imagen

Exception ignored in: <finalize object at 0x2436aaad960; dead> Traceback (most recent call last): File "C:\Program Files\Python310\lib\weakref.py", line 591, in call return info.func(*info.args, (info.kwargs or {})) File "C:\Program Files\Python310\lib\tempfile.py", line 859, in _cleanup cls._rmtree(name, ignore_errors=ignore_errors) File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Program Files\Python310\lib\shutil.py", line 620, in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) File "C:\Program Files\Python310\lib\tempfile.py", line 846, in onerror cls._rmtree(path, ignore_errors=ignore_errors) File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Program Files\Python310\lib\shutil.py", line 601, in _rmtree_unsafe onerror(os.scandir, path, sys.exc_info()) File "C:\Program Files\Python310\lib\shutil.py", line 598, in _rmtree_unsafe with os.scandir(path) as scandir_it: NotADirectoryError: [WinError 267] El nombre del directorio no es válido: 'C:\Users\juang\AppData\Local\Temp\tmpaoa1da84\S.mp4' Warning: temperature does not have a supported UI Exception ignored in: <finalize object at 0x2436ae5c340; dead> Traceback (most recent call last): File "C:\Program Files\Python310\lib\weakref.py", line 591, in call return info.func(*info.args, *(info.kwargs or {})) File "C:\Program Files\Python310\lib\tempfile.py", line 859, in _cleanup cls._rmtree(name, ignore_errors=ignore_errors) File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Program Files\Python310\lib\shutil.py", line 620, in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) File "C:\Program Files\Python310\lib\tempfile.py", line 846, in onerror cls._rmtree(path, ignore_errors=ignore_errors) File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Program Files\Python310\lib\shutil.py", line 601, in _rmtree_unsafe onerror(os.scandir, path, sys.exc_info()) File "C:\Program Files\Python310\lib\shutil.py", line 598, in _rmtree_unsafe with os.scandir(path) as scandir_it: NotADirectoryError: [WinError 267] El nombre del directorio no es válido: 'C:\Users\juang\AppData\Local\Temp\tmphokwhdm6\S.mp4' Warning: temperature does not have a supported UI Exception ignored in: <finalize object at 0x2436ae45800; dead> Traceback (most recent call last): File "C:\Program Files\Python310\lib\weakref.py", line 591, in call return info.func(info.args, (info.kwargs or {})) File "C:\Program Files\Python310\lib\tempfile.py", line 859, in _cleanup cls._rmtree(name, ignore_errors=ignore_errors) File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Program Files\Python310\lib\shutil.py", line 620, in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) File "C:\Program Files\Python310\lib\tempfile.py", line 846, in onerror cls._rmtree(path, ignore_errors=ignore_errors) File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Program Files\Python310\lib\shutil.py", line 601, in _rmtree_unsafe onerror(os.scandir, path, sys.exc_info()) File "C:\Program Files\Python310\lib\shutil.py", line 598, in _rmtree_unsafe with os.scandir(path) as scandir_it: NotADirectoryError: [WinError 267] El nombre del directorio no es válido: 'C:\Users\juang\AppData\Local\Temp\tmp43evlsvd\S.mp4' Warning: temperature does not have a supported UI 2024-01-03 00:00:14.026 Uncaught app exception Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 87, in get entry_bytes = self._read_from_mem_cache(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 137, in _read_from_mem_cache raise CacheStorageKeyNotFoundError("Key not found in mem cache") streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Key not found in mem cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 588, in read_result pickled_entry = self.storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 89, in get entry_bytes = self._persist_storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\local_disk_cache_storage.py", line 133, in get raise CacheStorageKeyNotFoundError( streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Local disk cache storage is disabled (persist=None)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 245, in _get_or_create_cached_value cached_result = cache.read_result(value_key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 590, in read_result raise CacheKeyNotFoundError(str(e)) from e streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Local disk cache storage is disabled (persist=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 87, in get entry_bytes = self._read_from_mem_cache(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 137, in _read_from_mem_cache raise CacheStorageKeyNotFoundError("Key not found in mem cache") streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Key not found in mem cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 588, in read_result pickled_entry = self.storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 89, in get entry_bytes = self._persist_storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\local_disk_cache_storage.py", line 133, in get raise CacheStorageKeyNotFoundError( streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Local disk cache storage is disabled (persist=None)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 293, in _handle_cache_miss cached_result = cache.read_result(value_key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 590, in read_result raise CacheKeyNotFoundError(str(e)) from e streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Local disk cache storage is disabled (persist=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 545, in run() File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 538, in run webui() File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 318, in webui subs = _transcribe(file_path, stt_model_name, model_config) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 194, in wrapper return cached_func(*args, kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 223, in call return self._get_or_create_cached_value(args, kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 248, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 302, in _handle_cache_miss computed_value = self._info.func(*func_args, *func_kwargs) File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 190, in _transcribe subs = subs_ai.transcribe(media_file=file_path, model=model) File "C:\Program Files\Python310\lib\site-packages\subsai\main.py", line 115, in transcribe return stt_model.transcribe(media_file) File "C:\Program Files\Python310\lib\site-packages\subsai\models\whisper_model.py", line 207, in transcribe audio = whisper.load_audio(media_file) File "C:\Program Files\Python310\lib\site-packages\whisper\audio.py", line 58, in load_audio out = run(cmd, capture_output=True, check=True).stdout File "C:\Program Files\Python310\lib\subprocess.py", line 503, in run with Popen(popenargs, kwargs) as process: File "C:\Program Files\Python310\lib\subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\Python310\lib\subprocess.py", line 1440, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado

abdeladim-s commented 6 months ago

There are so many exceptions. Seems like you are using the upload mode: NotADirectoryError: [WinError 267] El nombre del directorio no es válido: 'C:\Users\juang\AppData\Local\Temp\tmp43evlsvd\S.mp4'

What problem do you get when you use local path mode ?

lererledd commented 6 months ago

@abdeladim-s

local path mode:

2024-01-03 01:24:42.143 Uncaught app exception Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 87, in get entry_bytes = self._read_from_mem_cache(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 137, in _read_from_mem_cache raise CacheStorageKeyNotFoundError("Key not found in mem cache") streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Key not found in mem cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 588, in read_result pickled_entry = self.storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 89, in get entry_bytes = self._persist_storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\local_disk_cache_storage.py", line 133, in get raise CacheStorageKeyNotFoundError( streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Local disk cache storage is disabled (persist=None)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 245, in _get_or_create_cached_value cached_result = cache.read_result(value_key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 590, in read_result raise CacheKeyNotFoundError(str(e)) from e streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Local disk cache storage is disabled (persist=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 87, in get entry_bytes = self._read_from_mem_cache(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 137, in _read_from_mem_cache raise CacheStorageKeyNotFoundError("Key not found in mem cache") streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Key not found in mem cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 588, in read_result pickled_entry = self.storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\in_memory_cache_storage_wrapper.py", line 89, in get entry_bytes = self._persist_storage.get(key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\storage\local_disk_cache_storage.py", line 133, in get raise CacheStorageKeyNotFoundError( streamlit.runtime.caching.storage.cache_storage_protocol.CacheStorageKeyNotFoundError: Local disk cache storage is disabled (persist=None)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 293, in _handle_cache_miss cached_result = cache.read_result(value_key) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_data_api.py", line 590, in read_result raise CacheKeyNotFoundError(str(e)) from e streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Local disk cache storage is disabled (persist=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 545, in run() File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 538, in run webui() File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 318, in webui subs = _transcribe(file_path, stt_model_name, model_config) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 194, in wrapper return cached_func(*args, kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 223, in call return self._get_or_create_cached_value(args, kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 248, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "C:\Program Files\Python310\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 302, in _handle_cache_miss computed_value = self._info.func(*func_args, *func_kwargs) File "C:\Program Files\Python310\Lib\site-packages\subsai\webui.py", line 190, in _transcribe subs = subs_ai.transcribe(media_file=file_path, model=model) File "C:\Program Files\Python310\lib\site-packages\subsai\main.py", line 115, in transcribe return stt_model.transcribe(media_file) File "C:\Program Files\Python310\lib\site-packages\subsai\models\whisper_model.py", line 207, in transcribe audio = whisper.load_audio(media_file) File "C:\Program Files\Python310\lib\site-packages\whisper\audio.py", line 58, in load_audio out = run(cmd, capture_output=True, check=True).stdout File "C:\Program Files\Python310\lib\subprocess.py", line 503, in run with Popen(popenargs, kwargs) as process: File "C:\Program Files\Python310\lib\subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\Python310\lib\subprocess.py", line 1440, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado

abdeladim-s commented 6 months ago

Seems like there is something wrong with your installation and streamlit cannot store the cache. Could you please try an earlier version of streamlit, in your terminal run: pip install streamlit==1.19.0 for example ?

lererledd commented 6 months ago

Seems like there is something wrong with your installation and streamlit cannot store the cache. Could you please try an earlier version of streamlit, in your terminal run: pip install streamlit==1.19.0 for example ?

@abdeladim-s I just tried it and I still get the same error, how can I fix it?

abdeladim-s commented 6 months ago

In that case I would suggest to use Docker. It will take some time and space to build the image but at least it will work out of the box. You can follow the instructions on the Readme page. Let me know if you found any difficulties ?