Reputation: 441
I was trying to import some langchain
modules in a notebook in Microsoft Fabric like below.
The notebook is using Python 3.10
Step 1: pip install langchain openai
--> successful
Step 2:
from langchain.llms import OpenAI
from langchain.llms import AzureOpenAI
from langchain import PromptTemplate
from langchain.chat_models import ChatOpenAI
from langchain.chains import LLMChain
getting the below error:
ImportError: cannot import name 'TypeAliasType' from 'typing_extensions' (/home/trusted-service-user/cluster-env/trident_env/lib/python3.10/site-packages/typing_extensions.py)
I tried updating the typing_extensions
module in Python but nothing seems to work.
Can some please help.
Upvotes: 1
Views: 976
Reputation: 11329
I tried the same scenario in my environment, and I got same error while importing.
I followed the suggestion by @anovoselov from this ask and now it is working fine for me.
Try to re-import the typing_extensions
from the sys.path
before importing the langchain
.
import sys
del sys.modules["typing_extensions"]
Upvotes: 1