Skip to content

Mypy crashes when I import PyTorch 1.7.1 #9941

Closed
@TylerYep

Description

@TylerYep

Crash Report

Mypy crashes when I run it on a file that imports PyTorch 1.7.1 within a folder.

Traceback

...
LOG:  Writing torch.distributed.distributed_c10d /Users/tyler.yep/.pyenv/versions/3.9.0/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py torch/distributed/distributed_c10d.meta.json torch/distributed/distributed_c10d.data.json
LOG:  Cached module torch.distributed.distributed_c10d has same interface
LOG:  Writing torch.distributed /Users/tyler.yep/.pyenv/versions/3.9.0/lib/python3.9/site-packages/torch/distributed/__init__.py torch/distributed/__init__.meta.json torch/distributed/__init__.data.json
LOG:  Build finished in 94.339 seconds with 741 modules, and 1 errors

Traceback (most recent call last):
  File "/Users/tyler.yep/.pyenv/versions/3.9.0/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/Users/tyler.yep/.pyenv/versions/3.9.0/lib/python3.9/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 180, in build
  File "mypy/build.py", line 254, in _build
  File "mypy/build.py", line 2638, in dispatch
  File "mypy/build.py", line 2964, in process_graph
  File "mypy/build.py", line 3081, in process_stale_scc
  File "mypy/build.py", line 2252, in write_cache
  File "mypy/build.py", line 1462, in write_cache
  File "mypy/nodes.py", line 313, in serialize
  File "mypy/nodes.py", line 3140, in serialize
  File "mypy/nodes.py", line 3076, in serialize
AssertionError

To Reproduce
Place a file with the following contents in a folder:

import torch

Run mypy . from outside of that folder. (same directory as the setup.cfg)

Your Environment

  • Mypy version used: 0.800
  • Mypy command-line flags: mypy .
  • Mypy configuration options from setup.cfg:
[mypy]
strict = True
ignore_missing_imports = True
  • Python version used: 3.9.0
  • Operating system and version: Mac OS X

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions