Skip to content

from langchain.prompts import PromptTemplate` raises ImportError in langchain>=1.x #10

@TecheraFabrizio

Description

@TecheraFabrizio

Description

Importing PromptTemplate from langchain.prompts fails with a module resolution error in recent versions of LangChain.

Steps to reproduce

  1. Install langchain 1.2.10
  2. Run the following code:

from langchain.prompts import PromptTemplate

Expected behavior

PromptTemplate is importable from langchain.prompts as documented in most existing tutorials and examples.

Actual behavior

Module not found / cannot be resolved error.

Workaround

Use the following import instead:

from langchain_core.prompts import PromptTemplate

Environment

  • langchain: 1.2.10
  • langchain-core: 1.2.15
  • Python: 3.13
  • OS: Windows 11

Notes

Most tutorials and official examples still reference langchain.prompts, which leads to confusion for new users.
Either the old import path should be maintained for backwards compatibility, or the documentation and examples should be updated to reflect the new structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions