audiocraft icon indicating copy to clipboard operation
audiocraft copied to clipboard

Permission Error when writing track

Open ethank opened this issue 1 year ago • 6 comments

This is on Windows. It was working fine until the latest git pull this morning. The model runs fun with a prompt, but it won't write the resulting file.

Traceback (most recent call last): File "D:\Developer\audiocraft\audiocraft\data\audio.py", line 209, in audio_write ta.save(path, wav, sample_rate, **kwargs) File "C:\Users\ethan\miniconda3\lib\site-packages\torchaudio\backend\soundfile_backend.py", line 451, in save soundfile.write(file=filepath, data=src, samplerate=sample_rate, subtype=subtype, format=format) File "C:\Users\ethan\miniconda3\lib\site-packages\soundfile.py", line 430, in write with SoundFile(file, 'w', samplerate, channels, File "C:\Users\ethan\miniconda3\lib\site-packages\soundfile.py", line 740, in init self._file = self._open(file, mode_int, closefd) File "C:\Users\ethan\miniconda3\lib\site-packages\soundfile.py", line 1263, in _open raise TypeError("Invalid file: {0!r}".format(self.name)) TypeError: Invalid file: WindowsPath('C:/Users/ethan/AppData/Local/Temp/tmpg6flfv08.wav')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ethan\miniconda3\lib\site-packages\gradio\routes.py", line 393, in run_predict output = await app.get_blocks().process_api( File "C:\Users\ethan\miniconda3\lib\site-packages\gradio\blocks.py", line 1108, in process_api result = await self.call_function( File "C:\Users\ethan\miniconda3\lib\site-packages\gradio\blocks.py", line 915, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\ethan\miniconda3\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Users\ethan\miniconda3\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\Users\ethan\miniconda3\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "D:\Developer\audiocraft\app.py", line 138, in predict_full outs = _do_predictions( File "D:\Developer\audiocraft\app.py", line 102, in _do_predictions audio_write( File "D:\Developer\audiocraft\audiocraft\data\audio.py", line 213, in audio_write path.unlink() File "C:\Users\ethan\miniconda3\lib\pathlib.py", line 1206, in unlink self._accessor.unlink(self) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\ethan\AppData\Local\Temp\tmpg6flfv08.wav'

ethank avatar Jun 13 '23 17:06 ethank

same issue

bvrtekk avatar Jul 16 '23 17:07 bvrtekk

same issue

mathias2000269 avatar Oct 14 '23 01:10 mathias2000269

I have moved "musicgen_app.py" and "musicgen_demo.ipynb" together to the root folder. It worked for me. If you try to run in dome folder it couses an error. Also if you move "musicgen_app.py" alone it couses the "PermissionError: [WinError 32]" error. I hope it will be helpful.

soztrk avatar Oct 20 '23 07:10 soztrk

se ha resuelto el error ejecutando como administrador el anaconda prompt y moviendo "musicgen_app.py" y "musicgen_demo.ipynb" a la carpeta raiz como sugiere Soztrk, aunque esto ultimo no se si sea necesario

SirPiggy1 avatar Oct 23 '23 04:10 SirPiggy1

I have moved "musicgen_app.py" and "musicgen_demo.ipynb" together to the root folder. It worked for me. If you try to run in dome folder it couses an error. Also if you move "musicgen_app.py" alone it couses the "PermissionError: [WinError 32]" error. I hope it will be helpful.

i have moved both and still get the error :(

omgitsgb avatar Oct 30 '23 20:10 omgitsgb

You need to install ffmpeg on windows.

winget install ffmpeg Close all terminals or reboot pc.

Samyssmile avatar Dec 27 '23 22:12 Samyssmile