Skip to content

[BUG] Broken import: langchain_classic package does not exist in PyPI, crashes application on startup #733

Description

@vipul674

Description of the Bug

In backend/app/rag/agent.py, line 14, the module imports from a package called langchain_classic which does not exist on PyPI:

from langchain_classic.agents import create_react_agent, AgentExecutor

There is no standard Python package named langchain_classic available on PyPI. When agent.py is imported or loaded by the application (which happens during Celery worker initialization or when the RAG pipeline is used), this import raises:

ModuleNotFoundError: No module named 'langchain_classic'

Also on line 16:

from langchain_core.prompts import PromptTemplate

The import path langchain_core requires langchain >= 0.3. If the installed version is older, this will also fail.

The requirements.txt lists langchain-classic as a dependency. However, searching PyPI shows no package by this name exists. There is an archived langchain-classic package on GitHub but it is not published to PyPI and is deprecated/removed.

Steps to Reproduce

  1. Clone the repository and install dependencies: pip install -r backend/requirements.txt
  2. Try to import or start the Celery worker
  3. Observe ModuleNotFoundError: No module named 'langchain_classic'

Expected Behavior

The import should use a real, installable package. The correct import for create_react_agent and AgentExecutor in modern langchain (v0.1+) is:

from langchain.agents import create_react_agent, AgentExecutor

Or for langchain v0.3+:

from langchain.agents import create_react_agent, AgentExecutor

Impact

This import failure prevents the entire RAG agent pipeline from functioning. The application may start (if agent.py is not imported at startup), but any Celery task or chat endpoint that triggers agent logic will crash with ModuleNotFoundError.

Affected File

backend/app/rag/agent.py (lines 14, 16)

Suggested Fix

Update the imports to use the correct langchain package paths and update requirements.txt to pin a compatible langchain version.

GSSoC '26

  • Yes, I am participating in GirlScript Summer of Code and would like to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gssocGirlScript Summer of Code 2026 issue/PR

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions