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

ConnectionError**: HTTPConnectionPool(host='127.0.0.1', port=80): #28166

Open
5 tasks done
zhoufy20 opened this issue Nov 17, 2024 · 1 comment
Open
5 tasks done

ConnectionError**: HTTPConnectionPool(host='127.0.0.1', port=80): #28166

zhoufy20 opened this issue Nov 17, 2024 · 1 comment

Comments

@zhoufy20
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

When i execute it on wsl2 in my windows:

from langchain_community.llms import Ollama

llm = Ollama(
    base_url="http://127.0.0.1",
    model="gemma",
    timeout=100 
)

prompt = 'Give me one name for a new national park with jungle terrain?'

print(llm.invoke(prompt))

Error Message and Stack Trace (if applicable)

ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=80): Max retries exceeded with url: /api/generate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f67bdbca000>: Failed to establish a new connection: [Errno 111] Connection refused'))

Description

Additionally, i found that

  1. ping localhost:
ping localhost

Pinging FeiyuCome [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
  1. ping 127.0.0.1:
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

How can i slove this problem?

System Info

local windows environments:

image

conda env list:

Package                                  Version
---------------------------------------- -------------
absl-py                                  2.1.0
accelerate                               1.1.1
addict                                   2.4.0
aiohappyeyeballs                         2.4.3
aiohttp                                  3.10.10
aiosignal                                1.3.1
aliyun-python-sdk-core                   2.16.0
aliyun-python-sdk-kms                    2.16.5
annotated-types                          0.7.0
antlr4-python3-runtime                   4.9.3
anyio                                    4.6.2
argon2-cffi                              21.3.0
argon2-cffi-bindings                     21.2.0
asgiref                                  3.8.1
asttokens                                2.0.5
async-lru                                2.0.4
attrdict                                 2.0.1
attrs                                    24.2.0
Babel                                    2.11.0
backoff                                  2.2.1
bcrypt                                   4.2.0
beautifulsoup4                           4.12.3
binpacking                               1.5.2
bleach                                   4.1.0
blobfile                                 3.0.0
Brotli                                   1.0.9
build                                    1.2.2.post1
cachetools                               5.5.0
certifi                                  2024.8.30
cffi                                     1.17.1
charset-normalizer                       3.3.2
chroma-hnswlib                           0.7.6
chromadb                                 0.5.18
click                                    8.1.7
cloudpickle                              3.1.0
coloredlogs                              15.0.1
comm                                     0.2.1
compressed-tensors                       0.8.0
contourpy                                1.3.1
crcmod                                   1.7
cryptography                             43.0.3
cycler                                   0.12.1
dacite                                   1.8.1
dataclasses-json                         0.6.7
datasets                                 2.21.0
debugpy                                  1.6.7
decorator                                5.1.1
defusedxml                               0.7.1
Deprecated                               1.2.15
dill                                     0.3.8
diskcache                                5.6.3
distro                                   1.9.0
docker-pycreds                           0.4.0
docstring_parser                         0.16
durationpy                               0.9
einops                                   0.8.0
evaluate                                 0.4.3
executing                                0.8.3
fastapi                                  0.115.5
fastjsonschema                           2.16.2
filelock                                 3.16.1
flatbuffers                              24.3.25
fonttools                                4.55.0
frozenlist                               1.5.0
fsspec                                   2024.6.1
future                                   1.0.0
gguf                                     0.10.0
gitdb                                    4.0.11
GitPython                                3.1.43
google-auth                              2.36.0
googleapis-common-protos                 1.66.0
greenlet                                 3.1.1
grpcio                                   1.68.0
h11                                      0.14.0
httpcore                                 1.0.2
httptools                                0.6.4
httpx                                    0.27.0
httpx-sse                                0.4.0
huggingface-hub                          0.26.2
humanfriendly                            10.0
idna                                     3.7
importlib_metadata                       8.5.0
importlib_resources                      6.4.5
interegular                              0.3.3
ipykernel                                6.29.5
ipython                                  8.27.0
ipywidgets                               8.1.2
jedi                                     0.19.1
jieba                                    0.42.1
Jinja2                                   3.1.4
jiter                                    0.7.1
jmespath                                 0.10.0
joblib                                   1.4.2
json5                                    0.9.25
jsonpatch                                1.33
jsonpointer                              3.0.0
jsonschema                               4.23.0
jsonschema-specifications                2023.7.1
jupyter                                  1.0.0
jupyter_client                           8.6.0
jupyter-console                          6.6.3
jupyter_core                             5.7.2
jupyter-events                           0.10.0
jupyter-lsp                              2.2.0
jupyter_server                           2.14.1
jupyter_server_terminals                 0.4.4
jupyterlab                               4.2.5
jupyterlab-pygments                      0.1.2
jupyterlab_server                        2.27.3
jupyterlab-widgets                       3.0.10
kiwisolver                               1.4.7
kubernetes                               31.0.0
langchain                                0.3.7
langchain-community                      0.3.7
langchain-core                           0.3.19
langchain-text-splitters                 0.3.2
langsmith                                0.1.143
lark                                     1.2.2
llvmlite                                 0.43.0
lm-format-enforcer                       0.10.9
lxml                                     5.3.0
Markdown                                 3.7
markdown-it-py                           3.0.0
MarkupSafe                               2.1.3
marshmallow                              3.23.1
matplotlib                               3.9.2
matplotlib-inline                        0.1.6
mdurl                                    0.1.2
mistral_common                           1.5.0
mistune                                  2.0.4
mmh3                                     5.0.1
modelscope                               1.18.1
monotonic                                1.6
mpmath                                   1.3.0
ms-swift                                 2.6.0
msgpack                                  1.1.0
msgspec                                  0.18.6
multidict                                6.1.0
multiprocess                             0.70.16
mypy-extensions                          1.0.0
nbclient                                 0.8.0
nbconvert                                7.16.4
nbformat                                 5.10.4
nest-asyncio                             1.6.0
networkx                                 3.4.2
nltk                                     3.9.1
notebook                                 7.2.2
notebook_shim                            0.2.3
numba                                    0.60.0
numpy                                    1.26.4
nvidia-cublas-cu12                       12.4.5.8
nvidia-cuda-cupti-cu12                   12.4.127
nvidia-cuda-nvrtc-cu12                   12.4.127
nvidia-cuda-runtime-cu12                 12.4.127
nvidia-cudnn-cu12                        9.1.0.70
nvidia-cufft-cu12                        11.2.1.3
nvidia-curand-cu12                       10.3.5.147
nvidia-cusolver-cu12                     11.6.1.9
nvidia-cusparse-cu12                     12.3.1.170
nvidia-ml-py                             12.560.30
nvidia-nccl-cu12                         2.21.5
nvidia-nvjitlink-cu12                    12.4.127
nvidia-nvtx-cu12                         12.4.127
oauthlib                                 3.2.2
omegaconf                                2.3.0
onnxruntime                              1.20.0
openai                                   1.54.4
opencv-python-headless                   4.10.0.84
opentelemetry-api                        1.28.1
opentelemetry-exporter-otlp-proto-common 1.28.1
opentelemetry-exporter-otlp-proto-grpc   1.28.1
opentelemetry-instrumentation            0.49b1
opentelemetry-instrumentation-asgi       0.49b1
opentelemetry-instrumentation-fastapi    0.49b1
opentelemetry-proto                      1.28.1
opentelemetry-sdk                        1.28.1
opentelemetry-semantic-conventions       0.49b1
opentelemetry-util-http                  0.49b1
orjson                                   3.10.11
oss2                                     2.19.1
outlines                                 0.0.46
overrides                                7.4.0
packaging                                24.1
pandas                                   2.2.3
pandocfilters                            1.5.0
parso                                    0.8.3
partial-json-parser                      0.2.1.1.post4
peft                                     0.12.0
pexpect                                  4.8.0
pillow                                   10.4.0
pip                                      24.2
platformdirs                             3.10.0
ply                                      3.11
posthog                                  3.7.0
prometheus_client                        0.21.0
prometheus-fastapi-instrumentator        7.0.0
prompt-toolkit                           3.0.43
propcache                                0.2.0
protobuf                                 5.28.3
psutil                                   5.9.0
ptyprocess                               0.7.0
pure-eval                                0.2.2
py-cpuinfo                               9.0.0
pyairports                               2.1.1
pyarrow                                  18.0.0
pyasn1                                   0.6.1
pyasn1_modules                           0.4.1
pycountry                                24.6.1
pycparser                                2.21
pycryptodome                             3.21.0
pycryptodomex                            3.21.0
pydantic                                 2.9.2
pydantic_core                            2.23.4
pydantic-settings                        2.6.1
Pygments                                 2.15.1
pyparsing                                3.2.0
PyPika                                   0.48.9
pyproject_hooks                          1.2.0
PyQt5                                    5.15.10
PyQt5-sip                                12.13.0
PySocks                                  1.7.1
python-dateutil                          2.9.0.post0
python-dotenv                            1.0.1
python-json-logger                       2.0.7
pytz                                     2024.1
PyYAML                                   6.0.2
pyzmq                                    25.1.2
qtconsole                                5.6.0
QtPy                                     2.4.1
ray                                      2.39.0
referencing                              0.30.2
regex                                    2024.11.6
requests                                 2.32.3
requests-oauthlib                        2.0.0
requests-toolbelt                        1.0.0
rfc3339-validator                        0.1.4
rfc3986-validator                        0.1.1
rich                                     13.9.4
rouge                                    1.0.1
rpds-py                                  0.10.6
rsa                                      4.9
safetensors                              0.4.5
scikit-learn                             1.5.2
scipy                                    1.14.1
Send2Trash                               1.8.2
sentence-transformers                    3.3.0
sentencepiece                            0.2.0
sentry-sdk                               2.18.0
setproctitle                             1.3.3
setuptools                               75.5.0
shellingham                              1.5.4
shtab                                    1.7.1
simplejson                               3.19.3
sip                                      6.7.12
six                                      1.16.0
smmap                                    5.0.1
sniffio                                  1.3.0
sortedcontainers                         2.4.0
soupsieve                                2.5
SQLAlchemy                               2.0.35
stack-data                               0.2.0
starlette                                0.41.2
sympy                                    1.13.1
tenacity                                 9.0.0
tensorboard                              2.18.0
tensorboard-data-server                  0.7.2
terminado                                0.17.1
threadpoolctl                            3.5.0
tiktoken                                 0.7.0
tinycss2                                 1.2.1
tokenizers                               0.20.3
torch                                    2.5.1
torchao                                  0.6.1
torchtune                                0.4.0
torchvision                              0.20.1
tornado                                  6.4.1
tqdm                                     4.67.0
traitlets                                5.14.3
transformers                             4.46.2
transformers-stream-generator            0.0.5
triton                                   3.1.0
trl                                      0.11.4
typer                                    0.13.0
typing_extensions                        4.11.0
typing-inspect                           0.9.0
tyro                                     0.8.14
tzdata                                   2024.2
urllib3                                  2.2.3
uvicorn                                  0.32.0
uvloop                                   0.21.0
vllm                                     0.6.4.post1
wandb                                    0.18.7
watchfiles                               0.24.0
wcwidth                                  0.2.5
webencodings                             0.5.1
websocket-client                         1.8.0
websockets                               14.1
Werkzeug                                 3.1.3
wheel                                    0.44.0
widgetsnbextension                       4.0.10
wrapt                                    1.16.0
xformers                                 0.0.28.post3
xxhash                                   3.5.0
yarl                                     1.17.1
zipp                                     3.21.0

@farhan0167
Copy link

have you tried doing http://127.0.0.1:11434 instead of just http://127.0.0.1 as the base url because Ollama listens on port 11434 and not the default port 80 when you set just http://127.0.0.1

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