Skip to content

mypy error in efficientnet BlockArgs #2125

@masadcv

Description

@masadcv

Describe the bug
Running ./runtests.sh --mypy can sometimes lead to the following error on local machines:

Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/virtualenvs/dvenv/lib/python3.8/site-packages/mypy/main.py", line 23, in
console_entry()
File "/opt/virtualenvs/dvenv/lib/python3.8/site-packages/mypy/main.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 90, in main
File "mypy/build.py", line 179, in build
File "mypy/build.py", line 253, in _build
File "mypy/build.py", line 2638, in dispatch
File "mypy/build.py", line 2955, in process_graph
File "mypy/build.py", line 3033, in process_fresh_modules
File "mypy/build.py", line 1977, in fix_cross_refs
File "mypy/fixup.py", line 26, in fixup_module
File "mypy/fixup.py", line 77, in visit_symbol_table
File "mypy/fixup.py", line 301, in lookup_qualified_stnode
File "mypy/lookup.py", line 47, in lookup_fully_qualified
AssertionError: Cannot find component 'BlockArgs@791' for 'monai.networks.nets.efficientnet.BlockArgs@791'

This was reported in this pull request: #2066 (comment) by @lyndonboone

Opening this to record the issue and fix in a pull request.

To Reproduce
Steps to reproduce the behavior:

  1. Clone MONAI repo: git clone https://github.com/Project-MONAI/MONAI
  2. Install 'python setup.py develop'
  3. Run commands ./runtests.sh --mypy'

I was able to see the error message on Ubuntu 20.04.

Expected behavior
No error message when running mypy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions