langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
92.05k stars 14.65k forks source link

AttributeError: module 'langchain' has no attribute 'debug' #19278

Open KartikeyBartwal opened 5 months ago

KartikeyBartwal commented 5 months ago

Checked other resources

Example Code

from langchain_community.llms import Ollama

llm = Ollama(base_url = )

llm.invoke("Tell me a joke")

Error Message and Stack Trace (if applicable)

\python\python39\lib\site-packages (from dataclasses-json<0.7,>=0.5.7->langchain_community) (0.9.0) Requirement already satisfied: pydantic<3,>=1 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from langchain-core<0.2.0,>=0.1.31->langchain_community) (1.10.14)
Requirement already satisfied: anyio<5,>=3 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from langchain-core<0.2.0,>=0.1.31->langchain_community) (4.3.0) Requirement already satisfied: jsonpatch<2.0,>=1.33 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from langchain-core<0.2.0,>=0.1.31->langchain_community) (1.33) Requirement already satisfied: packaging<24.0,>=23.2 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from langchain-core<0.2.0,>=0.1.31->langchain_community) (23.2)Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->langchain_community) (2.2.1) Requirement already satisfied: idna<4,>=2.5 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->langchain_community) (3.6) Requirement already satisfied: certifi>=2017.4.17 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->langchain_community) (2024.2.2) Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from requests<3,>=2->langchain_community) (3.3.2) Requirement already satisfied: aiosignal>=1.1.2 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.3.1) Requirement already satisfied: async-timeout<5.0,>=4.0; python_version < "3.11" in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (4.0.3) Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.9.4) Requirement already satisfied: frozenlist>=1.1.1 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.4.1) Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (6.0.5) Requirement already satisfied: attrs>=17.3.0 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (23.2.0) Requirement already satisfied: orjson<4.0.0,>=3.9.14 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from langsmith<0.2.0,>=0.1.0->langchain_community) (3.9.15)
Requirement already satisfied: greenlet!=0.4.17; python_version >= "3" and (platform_machine == "aarch64" or (platform_machine == "ppc64le" or (platform_machine == "x86_64" or (platform_machine == "amd64" or (platform_machine == "AMD64" or (platform_machine == "win32" or platform_machine == "WIN32")))))) in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from SQLAlchemy<3,>=1.4->langchain_community) (3.0.3) Requirement already satisfied: typing-extensions>=3.7.4 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain_community) (4.10.0) Requirement already satisfied: mypy-extensions>=0.3.0 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain_community) (1.0.0) Requirement already satisfied: sniffio>=1.1 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from anyio<5,>=3->langchain-core<0.2.0,>=0.1.31->langchain_community) (1.3.1) Requirement already satisfied: exceptiongroup>=1.0.2; python_version < "3.11" in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from anyio<5,>=3->langchain-core<0.2.0Requirement already satisfied: jsonpointer>=1.9 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.2.0,>=0.1.31->langchain_community) (2.4) WARNING: You are using pip version 20.2.3; however, version 24.0 is available. You should consider upgrading via the 'c:\users\maste\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command. PS C:\Users\maste> pip install Ollama Collecting Ollama Downloading ollama-0.1.7-py3-none-any.whl (9.4 kB) Collecting httpx<0.26.0,>=0.25.2 Downloading httpx-0.25.2-py3-none-any.whl (74 kB) |████████████████████████████████| 74 kB 2.6 MB/s Requirement already satisfied: anyio in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->Ollama) (4.3.0) Requirement already satisfied: certifi in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->Ollama) (2024.2.2) Requirement already satisfied: sniffio in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->Ollama) (1.3.1) Collecting httpcore==1. Downloading httpcore-1.0.4-py3-none-any.whl (77 kB) |████████████████████████████████| 77 kB ... Requirement already satisfied: idna in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->Ollama) (3.6) Requirement already satisfied: exceptiongroup>=1.0.2; python_version < "3.11" in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from anyio->httpx<0.26.0,>=0.25.2->Ollama) (1.2.0) Requirement already satisfied: typing-extensions>=4.1; python_version < "3.11" in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from anyio->httpx<0.26.0,>=0.25.2->Ollama) (4.10.0) Collecting h11<0.15,>=0.13 |████████████████████████████████| 58 kB ... Installing collected packages: h11, httpcore, httpx, Ollama Successfully installed Ollama-0.1.7 h11-0.14.0 httpcore-1.0.4 httpx-0.25.2 WARNING: You are using pip version 20.2.3; however, version 24.0 is available. You should consider upgrading via the 'c:\users\maste\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command. PS C:\Users\maste> pip install ollama Requirement already satisfied: ollama in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (0.1.7) Requirement already satisfied: httpx<0.26.0,>=0.25.2 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from ollama) (0.25.2) Requirement already satisfied: httpcore==1. in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->ollama) (1.0.4) Requirement already satisfied: sniffio in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->ollama) (1.3.1) Requirement already satisfied: anyio in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->ollama) (4.3.0) Requirement already satisfied: certifi in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->ollama) (2024.2.2) Requirement already satisfied: idna in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpx<0.26.0,>=0.25.2->ollama) (3.6) Requirement already satisfied: h11<0.15,>=0.13 in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from httpcore==1.*->httpx<0.26.0,>=0.25.2->ollama) (0.14.0) Requirement already satisfied: exceptiongroup>=1.0.2; python_version < "3.11" in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from anyio->httpx<0.26.0,>=0.25.2->ollRequirement already satisfied: typing-extensions>=4.1; python_version < "3.11" in c:\users\maste\appdata\local\programs\python\python39\lib\site-packages (from anyio->httpx<0.26.0,>=0.25.2->ollama) (4.10.0) WARNING: You are using pip version 20.2.3; however, version 24.0 is available. You should consider upgrading via the 'c:\users\maste\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command. PS C:\Users\maste> python hello.py Traceback (most recent call last): File "C:\Users\maste\hello.py", line 5, in llm.invoke("Tell me a joke") File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\language_models\llms.py", line 246, in invoke self.generate_prompt( File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\language_models\llms.py", line 541, in generate_prompt return self.generate(prompt_strings, stop=stop, callbacks=callbacks, **kwargs) File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\language_models\llms.py", line 671, in generate CallbackManager.configure( File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\callbacks\manager.py", line 1443, in configure return _configure( File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\callbacks\manager.py", line 1950, in _configure debug = _get_debug() PS C:\Users\maste> python hello.py Traceback (most recent call last): File "C:\Users\maste\hello.py", line 19, in print(chain.invoke({"topic": "Space travel"})) File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\runnables\base.py", line 2209, in invoke callback_manager = get_callback_manager_for_config(config) File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\runnables\config.py", line 381, in get_callback_manager_for_config return CallbackManager.configure( File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\callbacks\manager.py", line 1443, in configure return _configure( File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\callbacks\manager.py", line 1950, in _configure debug = _get_debug() File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\callbacks\manager.py", line 57, in _get_debug return get_debug() File "C:\Users\maste\AppData\Local\Programs\Python\Python39\lib\site-packages\langchain_core\globals__init__.py", line 129, in get_debug old_debug = langchain.debug AttributeError: module '

Description

All I am trying to do is use Ollama using langchain for my web app. The invoke function always says debug does not exists and gives me an attribute error

System Info

from langchain_community.llms import Ollama

llm = Ollama(base_url = )

llm.invoke("Tell me a joke")

eyurtsev commented 5 months ago

what's your system information?

eyurtsev commented 5 months ago

output of: python -m langchain_core.sys_info

klemenp950 commented 2 months ago

An updated version of the class exists in the langchain-huggingface package and should be used instead. To use it run pip install -U langchain-huggingface and import as from langchain_huggingface import HuggingFacePipeline.

omige commented 1 month ago

the same problem as above. here is my sys_info:

System Information

OS: Windows OS Version: 10.0.19042 Python Version: 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]

Package Information

langchain_core: 0.2.12 langchain_community: 0.2.7 langsmith: 0.1.84 langchain_experimental: 0.0.62 langchain_text_splitters: 0.2.2

Packages not installed (Not Necessarily a Problem)

The following packages were not found:

langgraph langserve