Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not import NotRequired from typing_extensions.py #6245

Closed
1 of 14 tasks
AniketModi opened this issue Jun 15, 2023 · 2 comments
Closed
1 of 14 tasks

Can not import NotRequired from typing_extensions.py #6245

AniketModi opened this issue Jun 15, 2023 · 2 comments

Comments

@AniketModi
Copy link

AniketModi commented Jun 15, 2023

System Info

Langchain version >= 0.0.198 and python version 3.9

Who can help?

No response

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

Reproduction

  1. install python3.9

  2. install following requirements
    Flask==1.0.2
    jsonobject== 2.1.0
    gunicorn==20.1.0
    gevent==21.12.0
    greenlet==1.1.2
    py-healthcheck==1.9.0
    aenum==2.2.3
    flask-log-request-id==0.10.1
    numpy==1.19.5
    faiss-cpu==1.7.0
    sentence-transformers==2.2.2
    contractions==0.0.25
    grpcio==1.39.0
    tensorflow==2.6.0
    tensorflow-serving-api==2.5.2
    keras==2.6.0
    PyYAML~=6.0
    setuptools~=60.10.0
    requests~=2.28.2
    Werkzeug~=2.2.3
    transformers~=4.21.3
    Jinja2>=2.10.1,<3.1
    itsdangerous==2.0.1
    elastic-apm[flask]==6.7.0
    langchain==0.0.198
    openai==0.27.4
    redis==4.5.4
    tiktoken==0.2.0
    mysql-connector-python==8.0.33
    kafka-python==2.0.2
    pymongo==3.6.1

  3. import following library --
    from langchain.chains.conversational_retrieval.prompts import CONDENSE_QUESTION_PROMPT, QA_PROMPT

Expected behavior

When I am running project with LangChain >= 0.0.198, I am getting exception that Can't Import NotRequired from typing_extensions.py.

@devstein
Copy link

Generated by a 🤖

Answer

I found related issues that might be helpful. I did my best to summarize the solutions, but I recommend looking at the related issues yourself.

Related Issues

Closed Issues

import langchain with python<=3.9 fails

The suggested solution is:
Update pydantic to the latest version (1.10.8) which has fixed the issue as mentioned in this pull request. LangChain does not need an update as its pydantic dependency is already set to > 1.

To update pydantic, you can run:

pip install --upgrade pydantic

Then, you can test the update with the following commands:

python -m "import langchain"
pip freeze | grep pydantic

This response is meant to be helpful and save users time. It is not meant to be a precise solution.

Please leave a 👍 if this is helpful and 👎 if it is irrelevant

@dosubot
Copy link

dosubot bot commented Sep 15, 2023

Hi, @AniketModi! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

Based on my understanding, you reported an issue where running a project with LangChain version 0.0.198 or higher throws an exception related to importing "NotRequired" from typing_extensions.py. devstein suggested updating pydantic to the latest version (1.10.8) as it has fixed similar issues in the past. They provided instructions on how to update pydantic and test the update.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your contribution to the LangChain repository!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 15, 2023
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants