My python version is 3.7.16, and typing-extensions version is 4.7.1. I get the error on running the code below specifically the line importing the llama_index library. Packages are installed with pip. I ran it in Jupyter notebook in vscode.
from llama_index.graph_stores.neo4j import Neo4jPGStore
graph_store = Neo4jPGStore(
username=os.getenv("NEO4J_USERNAME"),
password=os.getenv("NEO4J_PASSWORD"),
url=os.getenv("NEO4J_URI"),
refresh_schema=False
)
I have tried reinstalling the libraries and using conda environment, all in vain. Error log:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/tmp/ipykernel_17914/1908928590.py in <module>
----> 1 from llama_index.graph_stores.neo4j import Neo4jPGStore
2
3
4 graph_store = Neo4jPGStore(
5 username=os.getenv("NEO4J_USERNAME"),
~/miniconda3/envs/thesis/lib/python3.7/site-packages/llama_index/__init__.py in <module>
13 # embeddings
14 from llama_index.embeddings.langchain import LangchainEmbedding
---> 15 from llama_index.embeddings.openai import OpenAIEmbedding
16
17 # structured
~/miniconda3/envs/thesis/lib/python3.7/site-packages/llama_index/embeddings/openai.py in <module>
4 from typing import Any, List, Optional
5
----> 6 import openai
7 from tenacity import retry, stop_after_attempt, wait_random_exponential
8
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/__init__.py in <module>
9 from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
10 from ._utils import file_from_path
---> 11 from ._client import Client, OpenAI, Stream, Timeout, Transport, AsyncClient, AsyncOpenAI, AsyncStream, RequestOptions
12 from ._models import BaseModel
13 from ._version import __title__, __version__
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/_client.py in <module>
9 import httpx
10
---> 11 from . import resources, _exceptions
12 from ._qs import Querystring
13 from ._types import (
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/resources/__init__.py in <module>
1 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
----> 3 from .beta import (
4 Beta,
5 AsyncBeta,
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/resources/beta/__init__.py in <module>
1 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
----> 3 from .beta import (
4 Beta,
5 AsyncBeta,
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/resources/beta/beta.py in <module>
3 from __future__ import annotations
4
----> 5 from .threads import (
6 Threads,
7 AsyncThreads,
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/resources/beta/threads/__init__.py in <module>
1 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
----> 3 from .runs import (
4 Runs,
5 AsyncRuns,
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/resources/beta/threads/runs/__init__.py in <module>
1 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
----> 3 from .runs import (
4 Runs,
5 AsyncRuns,
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/resources/beta/threads/runs/runs.py in <module>
10 import httpx
11
---> 12 from ..... import _legacy_response
13 from .steps import (
14 Steps,
~/miniconda3/envs/thesis/lib/python3.7/site-packages/openai/_legacy_response.py in <module>
18 overload,
19 )
---> 20 from typing_extensions import Awaitable, ParamSpec, override, deprecated, get_origin
21
22 import anyio
ImportError: cannot import name 'deprecated' from 'typing_extensions' (/home/sanjiv/miniconda3/envs/thesis/lib/python3.7/site-packages/typing_extensions.py)
I guess using a conda environment is the issue. Created a virtual environment instead with the same version of libraries and the error goes away.