MontrealCorpusTools / Montreal-Forced-Aligner

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

Error on release 1.0.1: cannot import name '_remove_dead_weakref' #253

Open nbusser opened 3 years ago

nbusser commented 3 years ago

Hello,

I'm facing an issue when trying to run the aligner from the release 1.0.1.

Traceback (most recent call last):
  File "site-packages/PyInstaller/loader/rthooks/pyi_rth_pkgres.py", line 11, in <module>
  File "/home/michael/miniconda3/envs/aligner/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
  File "site-packages/pkg_resources/__init__.py", line 24, in <module>
  File "/home/michael/miniconda3/envs/aligner/lib/python3.6/re.py", line 122, in <module>
  File "/home/michael/miniconda3/envs/aligner/lib/python3.6/enum.py", line 2, in <module>
  File "/home/michael/miniconda3/envs/aligner/lib/python3.6/types.py", line 171, in <module>
  File "/home/michael/miniconda3/envs/aligner/lib/python3.6/functools.py", line 23, in <module>
  File "/home/michael/miniconda3/envs/aligner/lib/python3.6/weakref.py", line 12, in <module>
ImportError: cannot import name '_remove_dead_weakref'
[149066] Failed to execute script pyi_rth_pkgres

I'm using a pyenv with python 3.6.0 Here is the list of commands I have written to arrive to this result:

tar -xzf montreal-forced-aligner_linux.tar.gz```
ln -s ~/.pyenv/versions/3.6.0/lib/libpython3.6m.so montreal-forced-aligner/lib/```
cd montreal-forced-aligner/bin```
./mfa_align

Do you have an idea of the source of this behavior ?

mmcauliffe commented 3 years ago

I'm not too sure, the old style of using frozen executables have some weird behavior. Can you try following the newer instructions for installation and see if that works better for you? https://montreal-forced-aligner.readthedocs.io/en/latest/installation.html

nbusser commented 3 years ago

We need to use a frozen release version for our project. It will be very clumsy for us if we have to handle a conda environment. Everything works with frozen release version 1.1.0 Beta 2. Can you tell me if you plan to do frozen release for more recent versions of MFA (like MFA 2.0) ?

mmcauliffe commented 3 years ago

I wasn't planning on it. The frozen release model was a source of a lot of headaches for me. It's possible that things have gotten better in that space in past couple of years, but in general, it took several days and many iteration each time I froze a release to get everything working on a decent range of test machines. These sort of reference were pretty common and it's hard to debug them. Additionally, I wanted to drop support for Phonetisaurus and transition to using Pynini for G2P since that's more actively maintained and removes the need for me to build the Phonetisaurus executables from scratch for releases (along with OpenFst and Ngram dependencies).

You could also go back to the code at the 1.0.1 tag, and run the freezing script with your updated 3.6 python library (taking the prebuilt third party exectubles from the one I have packaged up: https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/tree/e431cd51adc19b67dfa5af97e9536eb4b856d6a4.

With that said, I don't know too much about your use case, but it looks like it's Python-based, so you might get more mileage out of using MFA as a library. There might also be other solutions that might work for it (i.e., writing some platform specific install/run scripts that obfuscate the need for conda) if you wouldn't mind telling me more about your specific requirements.

nbusser commented 3 years ago

We want to be able to freeze our project that uses MFA as external dependency.
Since conda environment cannot be frozen directly, we would need to install every external dependencies by hand.
For the moment, we created such frozen environment using the Beta 2.
Does recent versions of MFA improve accuracy of alignment, or is it mostly bonded to the model we use ?