python / python/mypy

Crash Report - AssertionError: Cannot find module for langchain.schema.output_parser.BaseOutputParser

Open
#16,196 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

crash topic-daemon
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Mypy is crashing when recursively looking up the langchain package.

Traceback (most recent call last):
  File "mypy/dmypy_server.py", line 234, in serve
  File "mypy/dmypy_server.py", line 281, in run_command
  File "mypy/dmypy_server.py", line 349, in cmd_run
  File "mypy/dmypy_server.py", line 418, in check
  File "mypy/dmypy_server.py", line 667, in fine_grained_increment_follow_imports
  File "mypy/server/update.py", line 267, in update
  File "mypy/server/update.py", line 369, in update_one
  File "mypy/server/update.py", line 452, in update_module
  File "mypy/server/update.py", line 881, in propagate_changes_using_dependencies
  File "mypy/server/update.py", line 1010, in reprocess_nodes
  File "mypy/semanal_main.py", line 148, in semantic_analysis_for_targets
  File "mypy/semanal_main.py", line 439, in apply_class_plugin_hooks
  File "mypy/semanal_main.py", line 484, in apply_hooks_to_class
  File "mypy/plugins/dataclasses.py", line 231, in transform
  File "mypy/plugins/dataclasses.py", line 529, in collect_attributes
  File "mypy/plugins/dataclasses.py", line 190, in deserialize
  File "mypy/plugins/common.py", line 342, in deserialize_and_fixup_type
  File "mypy/types.py", line 2714, in accept
  File "mypy/fixup.py", line 337, in visit_union_type
  File "mypy/types.py", line 1414, in accept
  File "mypy/fixup.py", line 212, in visit_instance
  File "mypy/fixup.py", line 349, in lookup_fully_qualified_typeinfo
  File "mypy/lookup.py", line 31, in lookup_fully_qualified
AssertionError: Cannot find module for langchain.schema.output_parser.BaseOutputParser

[101] Error running mypy in /Users/shroominic/projects/neural-shirts: the mypy daemon crashed. This is probably a bug in mypy itself, see Output panel for details. The daemon will be restarted automatically.

To Reproduce

Install the langchain package (I tested between 0.0.277 and 0.0.302)

Your Environment

  • Mypy version used: 1.5.1
  • Python version used: 3.11.5
  • Operating system and version: macos

Workaround

You can disable mypy to check the langchain package in your mypy.ini or pyproject.toml:

[[tool.mypy.overrides]]
module = "langchain"
follow_imports = "skip"

Contributor guide

Open the contributing guide

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.

Research direction

Reproduce the crash by installing langchain 0.0.277–0.0.302 and running mypy with recursive imports. Start with mypy/fixup.py, mypy/lookup.py, and the dataclass plugin path shown in the traceback. Done means the daemon no longer raises this AssertionError while resolving langchain.schema.output_parser.BaseOutputParser.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.