Import error

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start with the imports shown in versalign/scoring.py and versalign/aligner.py, then reproduce the failure by importing from versalign.scoring before the aligner, msa, or pairwise modules. The issue is done when scoring imports successfully without requiring another module to be imported first, and the documented import order is no longer needed.

Written by the indexing model from the issue text.

Description

bug

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
Dominant language
Python
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.