ModuleNotFoundError — Jupyter Lab Langchain Import StrOutputParser

Nov 4, 2023

I was running into this error while going through the new course on Langchain:

When I ran:

from langchain.prompts import ChatPromptTemplate
from langchain.chat_models import ChatOpenAI
from langchain.schema.output_parser import StrOutputParser

I got:

ModuleNotFoundError Traceback (most recent call last)
Cell In[11], line 3
1 from langchain.prompts import ChatPromptTemplate
2 from langchain.chat_models import ChatOpenAI
— → 3 from langchain.schema.output_parser import StrOutputParser

ModuleNotFoundError: No module named 'langchain.schema.output_parser'; 'langchain.schema' is not a package

I resolved this issue by uninstalling Langflow which is a GUI based tool that uses Langchain under the hood.

pip uninstall langflow

After that, I updated langchain:

pip install — upgrade langchain

And I no longer got any errors when importing StrOutputParser!




Most of my writing is about software. I enjoy summarizing and analyzing books and self-help videos. I am senior software consultant at