[GH-ISSUE #6719] (111) Connection refused #66268

Closed
opened 2026-05-04 01:42:50 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @SheltonLiu-N on GitHub (Sep 10, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/6719

What is the issue?

I met a wired problem. When I use ollama in a server, I can run ollama run llama3.1:70b successfully in cmd, but failed in my python projects

process = subprocess.Popen("ollama serve", shell=True)
time.sleep(10)
ollama.pull("llama3.1:70b")

which returns:

<blockquote id="error">
<p><b>Connection to 127.0.0.1 failed.</b></p>
</blockquote>

<p id="sysmsg">The system returned: <i>(111) Connection refused</i></p>

also, I tested in cmd with:

curl http://127.0.0.1:11434/api/pull

and it returns:

div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://127.0.0.1:11434/api/pull">http://127.0.0.1:11434/api/pull</a></p>

<blockquote id="error">
<p><b>Connection to 127.0.0.1 failed.</b></p>
</blockquote>

<p id="sysmsg">The system returned: <i>(111) Connection refused</i></p>

I verified that the ollama is listening to 127.0.0.1:11434

How to solve this problem?

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

v0.3.10

Originally created by @SheltonLiu-N on GitHub (Sep 10, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/6719 ### What is the issue? I met a wired problem. When I use ollama in a server, I can run `ollama run llama3.1:70b` successfully in cmd, but failed in my python projects ``` process = subprocess.Popen("ollama serve", shell=True) time.sleep(10) ollama.pull("llama3.1:70b") ``` which returns: ``` <blockquote id="error"> <p><b>Connection to 127.0.0.1 failed.</b></p> </blockquote> <p id="sysmsg">The system returned: <i>(111) Connection refused</i></p> ``` also, I tested in cmd with: `curl http://127.0.0.1:11434/api/pull` and it returns: ```< div id="content"> <p>The following error was encountered while trying to retrieve the URL: <a href="http://127.0.0.1:11434/api/pull">http://127.0.0.1:11434/api/pull</a></p> <blockquote id="error"> <p><b>Connection to 127.0.0.1 failed.</b></p> </blockquote> <p id="sysmsg">The system returned: <i>(111) Connection refused</i></p> ``` I verified that the ollama is listening to `127.0.0.1:11434` How to solve this problem? ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version v0.3.10
GiteaMirror added the bug label 2026-05-04 01:42:52 -05:00
Author
Owner

@rick-github commented on GitHub (Sep 10, 2024):

What does the following return

curl --noproxy "*" localhost:11434
<!-- gh-comment-id:2340019404 --> @rick-github commented on GitHub (Sep 10, 2024): What does the following return ``` curl --noproxy "*" localhost:11434 ```
Author
Owner

@SheltonLiu-N commented on GitHub (Sep 10, 2024):

@rick-github Hi Rick, the return displays my GPU infos and shows that ollama is running:

time=2024-09-10T09:43:12.531-05:00 level=INFO source=payload.go:44 msg="Dynamic LLM libraries [cpu_avx cpu_avx2 cuda_v11 cuda_v12 rocm_v60102 cpu]"
time=2024-09-10T09:43:12.531-05:00 level=INFO source=gpu.go:200 msg="looking for compatible GPUs"
time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-050b457a-023b-cbf0-15b9-12910510da5c library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB"
time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-3581e78c-3f53-31e4-d1c5-e1602530cdae library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB"
time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-5e81643e-819f-c754-25e9-9416bf3e5126 library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB"
time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-7aa67590-ccf0-f7e2-cf7f-e6aa9cfdeaf2 library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB"
[GIN] 2024/09/10 - 09:43:14 | 200 |      58.361µs |       127.0.0.1 | GET      "/"
Ollama is running
<!-- gh-comment-id:2341074981 --> @SheltonLiu-N commented on GitHub (Sep 10, 2024): @rick-github Hi Rick, the return displays my GPU infos and shows that ollama is running: ``` time=2024-09-10T09:43:12.531-05:00 level=INFO source=payload.go:44 msg="Dynamic LLM libraries [cpu_avx cpu_avx2 cuda_v11 cuda_v12 rocm_v60102 cpu]" time=2024-09-10T09:43:12.531-05:00 level=INFO source=gpu.go:200 msg="looking for compatible GPUs" time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-050b457a-023b-cbf0-15b9-12910510da5c library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB" time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-3581e78c-3f53-31e4-d1c5-e1602530cdae library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB" time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-5e81643e-819f-c754-25e9-9416bf3e5126 library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB" time=2024-09-10T09:43:14.012-05:00 level=INFO source=types.go:107 msg="inference compute" id=GPU-7aa67590-ccf0-f7e2-cf7f-e6aa9cfdeaf2 library=cuda variant=v12 compute=8.0 driver=12.4 name="NVIDIA A100-SXM4-80GB" total="79.1 GiB" available="78.7 GiB" [GIN] 2024/09/10 - 09:43:14 | 200 | 58.361µs | 127.0.0.1 | GET "/" Ollama is running ```
Author
Owner

@rick-github commented on GitHub (Sep 10, 2024):

You have a client-side proxy configured, so connections from the ollama client and your python project are being sent to the proxy rather than going to localhost:11434. The most likely reason is you have HTTP_PROXY (or http_proxy) set in your environment. You can try adding no_proxy=localhost,127.0.0.0,127.0.0.1,127.0.1.1 to your environment, or unsetting HTTP_PROXY (http_proxy).

<!-- gh-comment-id:2341127549 --> @rick-github commented on GitHub (Sep 10, 2024): You have a client-side proxy configured, so connections from the `ollama` client and your python project are being sent to the proxy rather than going to `localhost:11434`. The most likely reason is you have `HTTP_PROXY` (or `http_proxy`) set in your environment. You can try adding `no_proxy=localhost,127.0.0.0,127.0.0.1,127.0.1.1` to your environment, or unsetting `HTTP_PROXY` (`http_proxy`).
Author
Owner

@SheltonLiu-N commented on GitHub (Sep 10, 2024):

It works! Thank you so much, Rick! @rick-github

<!-- gh-comment-id:2341239829 --> @SheltonLiu-N commented on GitHub (Sep 10, 2024): It works! Thank you so much, Rick! @rick-github
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#66268