examples icon indicating copy to clipboard operation
examples copied to clipboard

Error with Langchain demo notebook

Open Tylersuard opened this issue 2 years ago • 3 comments

Is this a new bug?

  • [X] I believe this is a new bug
  • [X] I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When running this notebook: https://colab.research.google.com/github/pinecone-io/examples/blob/master/generation/langchain/handbook/05-langchain-retrieval-augmentation.ipynb

from datasets import load_dataset causes this error:


AttributeError Traceback (most recent call last)

in <cell line: 1>() ----> 1 from datasets import load_dataset 2 3 data = load_dataset("wikipedia", "20220301.simple", split='train[:10000]') 4 data

8 frames

/usr/local/lib/python3.10/dist-packages/multiprocess/dummy/init.py in 85 # 86 ---> 87 class Condition(threading._Condition): 88 # XXX 89 if sys.version_info < (3, 0):

AttributeError: module 'threading' has no attribute '_Condition'

Expected Behavior

It should import load_dataset

Steps To Reproduce

Open this notebook and run all: https://colab.research.google.com/github/pinecone-io/examples/blob/master/generation/langchain/handbook/05-langchain-retrieval-augmentation.ipynb

Relevant log output

No response

Environment

Colab notebook

Additional Context

No response

Tylersuard avatar Jul 06 '23 02:07 Tylersuard

The following steps solve the problem for me: !pip install --upgrade datasets multiprocess

!pip install --upgrade protobuf apache-beam

you may need to restart the runtime after each of these executions

tytung2020 avatar Jul 14 '23 08:07 tytung2020

Thanks @tytung2020 . And !pip install -qU "pinecone-client[grpc]"==2.2.1 didn't give me issues like xx2.22. And...changed this

index = pinecone.GRPCIndex(index_name)

index.describe_index_stats()

To:

import time

index = pinecone.GRPCIndex(index_name)
# wait a moment for the index to be fully initialized
time.sleep(1)

index.describe_index_stats()

I'm simply replacing some code snippets in this notebook for what's working here

temiwale88 avatar Jul 17 '23 23:07 temiwale88

This Poetry setup has worked for me using Python 3.9 :

pyproject.toml

[tool.poetry]
name = "aiexplore"
version = "0.1.0"
description = "Exploring OpenAI"
readme = "README.md"

[tool.poetry.dependencies]
python = "~3.9.17"
openai = "^0.27.7"
dill = "~0.3.1.1"
multiprocess = "<0.70.9"
datasets = "2.12.0"
protobuf = "3.19.3"
apache-beam = "~2.46.0"
pinecone-client = { version = "2.2.1", extras = ["grpc"] }
mwparserfromhell = "^0.6.4"
langchain = "^0.0.162"
tiktoken = "0.4.0"

[tool.poetry.group.dev.dependencies]
ipykernel = "^6.25.0"
pipdeptree = "^2.12.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Then:

poetry install

davidonlaptop avatar Aug 07 '23 22:08 davidonlaptop