Skip to content

Import error #3

Description

@davidmeijer

When importing any method from versalign.scoring before importing a method from either the aligner, msa, or pairwise modules will results in an ImportError:

Traceback (most recent call last):
  File "/Users/davidmeijer/repos/CLM/./harvest/scripts/parse_retromol_results.py", line 14, in <module>
    from versalign.scoring import create_substituion_matrix_dynamically
  File "/Users/davidmeijer/miniforge3/envs/clm/lib/python3.10/site-packages/versalign/scoring.py", line 9, in <module>
    from versalign.aligner import substitution_matrices
  File "/Users/davidmeijer/miniforge3/envs/clm/lib/python3.10/site-packages/versalign/aligner.py", line 8, in <module>
    from versalign.scoring import T
ImportError: cannot import name 'T' from partially initialized module 'versalign.scoring' (most likely due to a circular import) (/Users/davidmeijer/miniforge3/envs/clm/lib/python3.10/site-packages/versalign/scoring.py)

The issue can be mitigated by importing the scoring module after importing either aligner, msa, or pairwise module first. This will work, for example:

from versalign.aligner import setup_aligner
from versalign.scoring import create_substituion_matrix_dynamically

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions