TalkBank / batchalign

Archived, legacy Batchalign system for CLAN Language Sample Analysis. Please visit the link below to use Batchalign.
https://github.com/talkbank/batchalign2
8 stars 2 forks source link

sqlalchemy.exc.ArgumentError #5

Closed FlamingoZh closed 1 year ago

FlamingoZh commented 1 year ago

Hi,

I got this error when I ran batchalign after installation. Note that I've actually installed the environment successfully a while ago, then recently I uninstalled the environment (via conda env remove) and reinstalled the environment, but this time it doesn't work:

Last login: Thu Feb  2 10:47:40 on console
(base) yuchen@psycomps-MacBook-Pro-2 ~ % curl -O "https://raw.githubusercontent.com/TalkBank/batchalign/master/environment.yml"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   115  100   115    0     0    598      0 --:--:-- --:--:-- --:--:--   614
(base) yuchen@psycomps-MacBook-Pro-2 ~ % conda env create -f environment.yml
Retrieving notices: ...working... done
Collecting package metadata (repodata.json): done
Solving environment: done

Downloading and Extracting Packages

Preparing transaction: done                                                     
Verifying transaction: done                                                     
Executing transaction: /                                                        
|                                                                               
done                                                                            
Installing pip dependencies: \ Ran pip subprocess with arguments:               
['/Users/yuchen/miniconda3/envs/batchalign/bin/python', '-m', 'pip', 'install', '-U', '-r', '/Users/yuchen/condaenv.erthoeel.requirements.txt', '--exists-action=b']                                                                            
Pip subprocess output:                                                          
Collecting rev_ai                                                               
  Using cached rev_ai-2.17.1-py2.py3-none-any.whl (37 kB)                       
Requirement already satisfied: six<2.0.0,>=1.12.0 in ./miniconda3/envs/batchalign/lib/python3.10/site-packages (from rev_ai->-r /Users/yuchen/condaenv.erthoeel.requirements.txt (line 1)) (1.16.0)                                             
Collecting websocket-client<1.0.0,>=0.56.0                                      
  Using cached websocket_client-0.59.0-py2.py3-none-any.whl (67 kB)             
Requirement already satisfied: requests<3.0.0,>=2.21.0 in ./miniconda3/envs/batchalign/lib/python3.10/site-packages (from rev_ai->-r /Users/yuchen/condaenv.erthoeel.requirements.txt (line 1)) (2.28.2)                                        
Requirement already satisfied: certifi>=2017.4.17 in ./miniconda3/envs/batchalign/lib/python3.10/site-packages (from requests<3.0.0,>=2.21.0->rev_ai->-r /Users/yuchen/condaenv.erthoeel.requirements.txt (line 1)) (2022.12.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./miniconda3/envs/batchalign/lib/python3.10/site-packages (from requests<3.0.0,>=2.21.0->rev_ai->-r /Users/yuchen/condaenv.erthoeel.requirements.txt (line 1)) (1.26.14)
Requirement already satisfied: idna<4,>=2.5 in ./miniconda3/envs/batchalign/lib/python3.10/site-packages (from requests<3.0.0,>=2.21.0->rev_ai->-r /Users/yuchen/condaenv.erthoeel.requirements.txt (line 1)) (3.4)
Requirement already satisfied: charset-normalizer<4,>=2 in ./miniconda3/envs/batchalign/lib/python3.10/site-packages (from requests<3.0.0,>=2.21.0->rev_ai->-r /Users/yuchen/condaenv.erthoeel.requirements.txt (line 1)) (2.1.1)
Installing collected packages: websocket-client, rev_ai
  Attempting uninstall: websocket-client
    Found existing installation: websocket-client 1.5.0
    Uninstalling websocket-client-1.5.0:
      Successfully uninstalled websocket-client-1.5.0
Successfully installed rev_ai-2.17.1 websocket-client-0.59.0

done
#
# To activate this environment, use
#
#     $ conda activate batchalign
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) yuchen@psycomps-MacBook-Pro-2 ~ % conda activate batchalign
(batchalign) yuchen@psycomps-MacBook-Pro-2 ~ % batchalign
Traceback (most recent call last):
  File "/Users/yuchen/miniconda3/envs/batchalign/bin/batchalign", line 11, in <module>
    sys.exit(mainloop())
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/baln/command_line.py", line 58, in mainloop
    from .fa import do_align
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/baln/fa.py", line 46, in <module>
    from montreal_forced_aligner.command_line.align import run_align_corpus
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/__init__.py", line 4, in <module>
    import montreal_forced_aligner.acoustic_modeling as acoustic_modeling
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/acoustic_modeling/__init__.py", line 7, in <module>
    from montreal_forced_aligner.acoustic_modeling.base import AcousticModelTrainingMixin  # noqa
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/acoustic_modeling/base.py", line 20, in <module>
    from montreal_forced_aligner.alignment import AlignMixin
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/alignment/__init__.py", line 6, in <module>
    from montreal_forced_aligner.alignment.adapting import AdaptingAligner
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/alignment/adapting.py", line 15, in <module>
    from montreal_forced_aligner.alignment.multiprocessing import AccStatsArguments, AccStatsFunction
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/alignment/multiprocessing.py", line 28, in <module>
    from montreal_forced_aligner.db import (
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/montreal_forced_aligner/db.py", line 327, in <module>
    class Word(MfaSqlBase):
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/decl_api.py", line 199, in __init__
    _as_declarative(reg, cls, dict_)
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 247, in _as_declarative
    return _MapperConfig.setup_mapping(registry, cls, dict_, None, {})
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 328, in setup_mapping
    return _ClassScanMapperConfig(
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 559, in __init__
    self._scan_attributes()
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 1001, in _scan_attributes
    collected_annotation = self._collect_annotation(
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 1151, in _collect_annotation
    extracted = _extract_mapped_subtype(
  File "/Users/yuchen/miniconda3/envs/batchalign/lib/python3.10/site-packages/sqlalchemy/orm/util.py", line 2306, in _extract_mapped_subtype
    raise sa_exc.ArgumentError(
sqlalchemy.exc.ArgumentError: Type annotation for "Word.dictionary" can't be correctly interpreted for Annotated Declarative Table form.  ORM annotations should normally make use of the ``Mapped[]`` generic type, or other ORM-compatible generic type, as a container for the actual type, which indicates the intent that the attribute is mapped. Class variables that are not intended to be mapped by the ORM should use ClassVar[].  To allow Annotated Declarative to disregard legacy annotations which don't use Mapped[] to pass, set "__allow_unmapped__ = True" on the class or a superclass this class. (Background on this error at: https://sqlalche.me/e/20/zlpr)
(batchalign) yuchen@psycomps-MacBook-Pro-2 ~ % 
Jemoka commented 1 year ago

Hi! Thanks so much for the feedback! Looks like the latest version of Batchalign and MFA doesn't play quite well together. I am releasing a new version, and will update this thread as soon as that becomes available. Thanks so much!

Jemoka commented 1 year ago

Done. I just updated batchalign to v0.0.14 for the macOS M1 platform. Could you please try updating batchalign with conda update batchalign -c talkbank and see if the new packages patches the issue? Feel free to reopen if the issue persists—then in which case there's a chance that there's a MFA cached dependency problem somewhere.

Jemoka commented 1 year ago

Looks like the issue is still persisting between two versions. I believe there is a cached dependency problem somewhere in MFA

Jemoka commented 1 year ago

It looks like this issue can be resolved with an update should it occur on any other platforms. Could you please try running conda activate batchalign -c talkbank?

Feel free to reopen the issue if it crops up again. Thank you very much!

FlamingoZh commented 1 year ago

Yes it's fixed now, thanks!