Closed Cartasiane closed 1 year ago
Thank you for the report! It is a known (and annoying) issue.
I'm not familiar enough with Windows to understand and fix this quickly, I need to dig. PRs are welcomed! This is a good first issue, if you ever want to try to fix it :)
The error message: (PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
) indicates that some process is still using a file or directory in the folder you're trying to remove with shutil.rmtree()
.
This is because stemgen is using os.chdir(os.path.join(OUTPUT_PATH, FILE_NAME))
to change the current working directory. If the Python process (or any other running process) is in the directory you're trying to delete, you'll get a permission error. Before removing the directory, you should change back to some other directory.
I made a pull request (https://github.com/axeldelafosse/stemgen/pull/39) with the following changes to the cleanup process: Bug Fix:
OUTPUT_PATH
to ensure we are not inside the directory we're trying to delete.
Minor Improvementsos.path.join()
consistently instead of a mix of string concatenation and joining. This ensures paths are constructed in a platform-independent manner.try-except
block around the shutil.rmtree()
call. If a PermissionError
occurs, a message is printed indicating the directory might still be in use. This provides a clearer error message and ensures the script doesn't crash due to this specific error.I also added the following improvement for windows users with a GPU:
-d
/--device
flag).
If no CUDA support is detected, the script will use the CPU instead.FWIW, Demucs without any -d flag defaults to CUDA-if-available-otherwise-CPU.
@awesomer, yes but there isn't a way of doing that without changing the code because "cpu" is set as the default value in argparse. So if I omit the -d
flag, stemgen defaults back to -d cpu
Fixed by https://github.com/axeldelafosse/stemgen/pull/39. Closing this!
I always get this error on different windows install:
[Done 6/6]