Whisper showing file not found error on vs code

I want to implement whisper on VScode. I have tried this using 3.9.9 and 3.11 versions of python with the same error. audio is not getting loaded and I keep getting the File Not Found error. I have given the correct path for the audio.

import wave
import os
from IPython.display import Audio, display
    CHUNK = 1024
    FORMAT = pyaudio.paInt16
    CHANNELS = 2
    RATE = 44100

    p = pyaudio.PyAudio()

    stream = p.open(format=FORMAT,


    frames = []
    for i in range(0, int(RATE / CHUNK * duration_seconds)):
        data = stream.read(CHUNK)

    print("Finished recording.")


    file_name = "audio_30.wav"  # You can customize the file name if needed
    file_path = os.path.join(file_path, file_name)

    with wave.open(file_path, 'wb') as wf:

if __name__ == "__main__":
    target_directory = #give directory path
    duration_seconds = 10  # Adjust the duration as needed
    record_audio(target_directory, duration_seconds)
import whisper
model= whisper.load_model('base')

FWIW, I am getting the same thing calling Whisper with CoLab. It worked perfectly in November 2023.

Hey! so I was able to solve the problem by defining the path to my ffmpeg installation.
I didn’t get this error when implementing on CoLab. U might need to check the pre-requisite installations.

1 Like

Thanks, but I’m using the same CoLab notebook from November that ran successfully maybe 50 times. But when I drag a WAV or MP3 file to the folder icon to upload and then run the code, I always get these strange file errors. I can’t specify the path because it’s uploaded to a Google drive somewhere:

!whisper “TRF2402_Dennis.wav” --model small

Traceback (most recent call last):
File “/usr/lib/python3.10/urllib/request.py”, line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File “/usr/lib/python3.10/http/client.py”, line 1283, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/usr/lib/python3.10/http/client.py”, line 1329, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/usr/lib/python3.10/http/client.py”, line 1278, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/usr/lib/python3.10/http/client.py”, line 1038, in _send_output
File “/usr/lib/python3.10/http/client.py”, line 976, in send
File “/usr/lib/python3.10/http/client.py”, line 1455, in connect
self.sock = self._context.wrap_socket(self.sock,
File “/usr/lib/python3.10/ssl.py”, line 513, in wrap_socket
return self.sslsocket_class._create(
File “/usr/lib/python3.10/ssl.py”, line 1100, in _create
File “/usr/lib/python3.10/ssl.py”, line 1371, in do_handshake
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/bin/whisper”, line 8, in
File “/usr/local/lib/python3.10/dist-packages/whisper/transcribe.py”, line 577, in cli
model = load_model(model_name, device=device, download_root=model_dir)
File “/usr/local/lib/python3.10/dist-packages/whisper/init.py”, line 133, in load_model
checkpoint_file = _download(_MODELS[name], download_root, in_memory)
File “/usr/local/lib/python3.10/dist-packages/whisper/init.py”, line 69, in _download
with urllib.request.urlopen(url) as source, open(download_target, “wb”) as output:
File “/usr/lib/python3.10/urllib/request.py”, line 216, in urlopen
return opener.open(url, data, timeout)
File “/usr/lib/python3.10/urllib/request.py”, line 519, in open
response = self._open(req, data)
File “/usr/lib/python3.10/urllib/request.py”, line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File “/usr/lib/python3.10/urllib/request.py”, line 496, in _call_chain
result = func(*args)
File “/usr/lib/python3.10/urllib/request.py”, line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File “/usr/lib/python3.10/urllib/request.py”, line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 104] Connection reset by peer>

It also occurs with the “Insanely Fast Whisper” version.

hiii i am facing the same issue…on jupyter can someone help me

hey! my problem went away when i defined the path to my ffmpeg installation, maybe u can try doing that