MontrealCorpusTools / Montreal-Forced-Aligner

Command line utility for forced alignment using Kaldi
https://montrealcorpustools.github.io/Montreal-Forced-Aligner/
MIT License
1.29k stars 242 forks source link

[BUG] PermissionError #535

Open T1uTiu opened 1 year ago

T1uTiu commented 1 year ago

When I just use any command, even "mfa -version", there is permissionerror.

Traceback (most recent call last): File "D:\Program Files (x86)\Anaconda\envs\diffsinger\Scripts\mfa-script.py", line 10, in sys.exit(main()) File "D:\Program Files (x86)\Anaconda\envs\diffsinger\lib\site-packages\montreal_forced_aligner\command_line\mfa.py", line 1031, in main check_third_party() File "D:\Program Files (x86)\Anaconda\envs\diffsinger\lib\site-packages\montreal_forced_aligner\utils.py", line 160, in check_third_party p = subprocess.run([thirdparty_binary(fn), "--help"], capture_output=True, text=True) File "D:\Program Files (x86)\Anaconda\envs\diffsinger\lib\subprocess.py", line 493, in run with Popen(*popenargs, **kwargs) as process: File "D:\Program Files (x86)\Anaconda\envs\diffsinger\lib\subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "D:\Program Files (x86)\Anaconda\envs\diffsinger\lib\subprocess.py", line 1311, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, PermissionError: [WinError 5] access deny。

mmcauliffe commented 1 year ago

I'll add a wrapper around that check call to include more information, but it seems like there's an issue finding or running the kaldi executables.

Can you try running each of the following from the conda environment command line and see why they're failing?

compute-mfcc-feats
compute-and-process-kaldi-pitch-feats
gmm-align-compiled
gmm-est-fmllr
gmm-est-fmllr-gpost
lattice-oracle
gmm-latgen-faster
fstdeterminizestar
fsttablecompose
gmm-rescore-lattice
mfaytak commented 6 months ago

Hi Michael. I have an undergraduate who is having this exact error on a fresh install of the MFA through the conda create -n aligner -c conda-forge montreal-forced-aligner approach detailed in the installation docs. He is using full Anaconda (again a fresh install) on Windows 11.

His traceback when he activates the (otherwise properly built?) virtual env and tries to run any mfa [xxx] command is below. It looks to be a permission error. He says he is not able to run the windows Anaconda Prompt, which is the only avenue to install I am aware of, "as Administrator" so this may be a factor.

(aligner) C:\Users\User Name>mfa validate
Traceback (most recent call last):
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\montreal_forced_aligner\utils.py", line 291, in check_third_party
    p = subprocess.run([thirdparty_binary(fn), "--help"], capture_output=True, text=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User Name\anaconda3\envs\aligner\Scripts\mfa-script.py", line 9, in <module>
    sys.exit(mfa_cli())
             ^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\rich_click\rich_command.py", line 126, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\click\core.py", line 1685, in invoke
    super().invoke(ctx)
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\click\decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\montreal_forced_aligner\command_line\mfa.py", line 167, in mfa_cli
    check_third_party()
  File "C:\Users\User Name\anaconda3\envs\aligner\Lib\site-packages\montreal_forced_aligner\utils.py", line 293, in check_third_party
    raise ThirdpartyError(fn, error_text=str(e))
montreal_forced_aligner.exceptions.ThirdpartyError: ThirdpartyError:

There was an error when invoking 'compute-mfcc-feats':
[WinError 5] Access is denied
This likely indicates that MFA's dependencies were not correctly installed, or there is an issue with your Conda environment.
If you are in the correct environment, please try re-creating the environment from scratch as a first step, i.e.:
conda create -n aligner -c conda-forge montreal-forced-aligner
mmcauliffe commented 6 months ago

One thing to try would be to uninstall the system anaconda installation, go through the miniconda installation, which should install to C:\Users\username\miniconda3, and then follow the rest of the instructions https://montreal-forced-aligner.readthedocs.io/en/latest/installation.html#general-installation. That should allow for running conda via the normal command line via "cmd.exe" from start menu.

Other debugging steps, in the environment prompt try running where compute-mfcc-feats.exe, if it doesn't print anything, then Kaldi was likely not installed correctly, so I'd recommend just recreating the environment conda create -n aligner -c conda-forge montreal-forced-aligner (maybe MFA was installed via pip rather than conda?). If it's a permission issue from some administrator elevation at some point, then a differently named environment might be necessary (conda create -n aligner2 -c conda-forge montreal-forced-aligner). It should be possible to run the anaconda prompt as administrator generally though via right clicking it in the start menu, or tracking down where the exe is. Generally though, I'd avoid this and try to get it installed via a User installation of miniconda since MFA doesn't require access to system files and it's best not to grant those permissions if they're not necessary.