Greetings,
In trying to rerun the class code in my local environment, I am running into a snag with the tenacity module. When I checked, it shows tenacity v8.2.2 is installed.
This is what happens - I run this code (incidentally, this worked yesterday is now failing today):
from langchain.document_loaders import PyPDFLoader
loader = PyPDFLoader("docs/NIST-Privacy-Framework-V1.0-Core-PDF.pdf")
pages = loader.load()
And then the error that is returned looks like what I am pasting in below. Does anyone have any ideas? I’ve installed, re-installed, upgraded LangChain etc, and installed Tenacity on its own too.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[7], line 1
----> 1 from langchain.document_loaders import PyPDFLoader
2 loader = PyPDFLoader("docs/NIST-Privacy-Framework-V1.0-Core-PDF.pdf")
3 pages = loader.load()
File ~/anaconda3/lib/python3.10/site-packages/langchain/__init__.py:6
3 from importlib import metadata
4 from typing import Optional
----> 6 from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
7 from langchain.cache import BaseCache
8 from langchain.chains import (
9 ConversationChain,
10 LLMBashChain,
(...)
18 VectorDBQAWithSourcesChain,
19 )
File ~/anaconda3/lib/python3.10/site-packages/langchain/agents/__init__.py:2
1 """Interface for agents."""
----> 2 from langchain.agents.agent import (
3 Agent,
4 AgentExecutor,
5 AgentOutputParser,
6 BaseMultiActionAgent,
7 BaseSingleActionAgent,
8 LLMSingleActionAgent,
9 )
10 from langchain.agents.agent_toolkits import (
11 create_csv_agent,
12 create_json_agent,
(...)
21 create_vectorstore_router_agent,
22 )
23 from langchain.agents.agent_types import AgentType
File ~/anaconda3/lib/python3.10/site-packages/langchain/agents/agent.py:16
13 from pydantic import BaseModel, root_validator
15 from langchain.agents.agent_types import AgentType
---> 16 from langchain.agents.tools import InvalidTool
17 from langchain.base_language import BaseLanguageModel
18 from langchain.callbacks.base import BaseCallbackManager
File ~/anaconda3/lib/python3.10/site-packages/langchain/agents/tools.py:4
1 """Interface for tools."""
2 from typing import Optional
----> 4 from langchain.callbacks.manager import (
5 AsyncCallbackManagerForToolRun,
6 CallbackManagerForToolRun,
7 )
8 from langchain.tools.base import BaseTool, Tool, tool
11 class InvalidTool(BaseTool):
File ~/anaconda3/lib/python3.10/site-packages/langchain/callbacks/__init__.py:13
11 from langchain.callbacks.human import HumanApprovalCallbackHandler
12 from langchain.callbacks.infino_callback import InfinoCallbackHandler
---> 13 from langchain.callbacks.manager import (
14 get_openai_callback,
15 tracing_enabled,
16 wandb_tracing_enabled,
17 )
18 from langchain.callbacks.mlflow_callback import MlflowCallbackHandler
19 from langchain.callbacks.openai_info import OpenAICallbackHandler
File ~/anaconda3/lib/python3.10/site-packages/langchain/callbacks/manager.py:37
35 from langchain.callbacks.openai_info import OpenAICallbackHandler
36 from langchain.callbacks.stdout import StdOutCallbackHandler
---> 37 from langchain.callbacks.tracers.langchain import LangChainTracer
38 from langchain.callbacks.tracers.langchain_v1 import LangChainTracerV1, TracerSessionV1
39 from langchain.callbacks.tracers.stdout import ConsoleCallbackHandler
File ~/anaconda3/lib/python3.10/site-packages/langchain/callbacks/tracers/__init__.py:3
1 """Tracers that record execution of LangChain runs."""
----> 3 from langchain.callbacks.tracers.langchain import LangChainTracer
4 from langchain.callbacks.tracers.langchain_v1 import LangChainTracerV1
5 from langchain.callbacks.tracers.stdout import ConsoleCallbackHandler
File ~/anaconda3/lib/python3.10/site-packages/langchain/callbacks/tracers/langchain.py:11
8 from typing import Any, Dict, List, Optional, Set, Union
9 from uuid import UUID
---> 11 from langchainplus_sdk import LangChainPlusClient
13 from langchain.callbacks.tracers.base import BaseTracer
14 from langchain.callbacks.tracers.schemas import Run, RunTypeEnum, TracerSession
File ~/anaconda3/lib/python3.10/site-packages/langchainplus_sdk/__init__.py:4
1 """LangChain+ Client."""
2 from importlib import metadata
----> 4 from langchainplus_sdk.client import LangChainPlusClient
5 from langchainplus_sdk.evaluation.evaluator import EvaluationResult, RunEvaluator
6 from langchainplus_sdk.run_trees import RunTree
File ~/anaconda3/lib/python3.10/site-packages/langchainplus_sdk/client.py:30
28 from pydantic import BaseSettings, Field, root_validator
29 from requests import Response
---> 30 from tenacity import (
31 before_sleep_log,
32 retry_if_exception_type,
33 stop_after_attempt,
34 wait_exponential,
35 )
37 from langchainplus_sdk.evaluation.evaluator import RunEvaluator
38 from langchainplus_sdk.schemas import (
39 APIFeedbackSource,
40 Dataset,
(...)
54 TracerSessionResult,
55 )
ModuleNotFoundError: No module named 'tenacity'
Is it possible that with all of the installing and reinstalling, I’ve mucked up the environment?
Thanks,
Kim