Local client connection with localhost:8080 failed

Hi All,

I am new to weaviate and try to do RAG with langchain and using Huggingface embeddings.
I have downloaded the yaml file and got it running in a docker container.
I am using windows10 and have wsl installed. I can see that localhost:8080/v1 displaying the links.
I have a windows conda environment py10.

import weaviate
client = weaviate.Client(‘http://weaviate:8080’)
print(‘after client connection’)
then i get the following error… I do NOT see the print statement.
What I am doing wrong?

error

(py10) E:\llmchat>python weaviate_langch.py
Traceback (most recent call last):
File “E:\Anaconda3\envs\py10\lib\site-packages\urllib3\connection.py”, line 174, in _new_conn
conn = connection.create_connection(
File “E:\Anaconda3\envs\py10\lib\site-packages\urllib3\util\connection.py”, line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File “E:\Anaconda3\envs\py10\lib\socket.py”, line 955, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “E:\Anaconda3\envs\py10\lib\site-packages\weaviate\connect\connection.py”, line 647, in wait_for_weaviate
requests.get(ready_url, headers=self._get_request_header()).raise_for_status()
File “E:\Anaconda3\envs\py10\lib\site-packages\requests\api.py”, line 73, in get
return request(“get”, url, params=params, **kwargs)
File “E:\Anaconda3\envs\py10\lib\site-packages\requests\api.py”, line 59, in request
return session.request(method=method, url=url, **kwargs)
File “E:\Anaconda3\envs\py10\lib\site-packages\requests\sessions.py”, line 587, in request
resp = self.send(prep, **send_kwargs)
File “E:\Anaconda3\envs\py10\lib\site-packages\requests\sessions.py”, line 701, in send
r = adapter.send(request, **kwargs)
File “E:\Anaconda3\envs\py10\lib\site-packages\requests\adapters.py”, line 520, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘weaviate’, port=8080): Max retries exceeded with (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000017E44D34DF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “E:\llmchat\weaviate_langch.py”, line 25, in
client = weaviate.Client(‘http://weaviate:8080’)
File “E:\Anaconda3\envs\py10\lib\site-packages\weaviate\client.py”, line 150, in init
self._connection = Connection(
File “E:\Anaconda3\envs\py10\lib\site-packages\weaviate\connect\connection.py”, line 163, in init
self.wait_for_weaviate(startup_period)
File “E:\Anaconda3\envs\py10\lib\site-packages\weaviate\connect\connection.py”, line 650, in wait_for_weaviate
raise WeaviateStartUpError(
weaviate.exceptions.WeaviateStartUpError: Weaviate did not start up in 5 seconds. Either the Weaviate URL wrong or Weaviate did not start up in the interval given in ‘startup_period’.

Hi @htbit1990 !! Welcome to our community :hugs:

If both Weaviate and your App are running from the same docker-compose file, they should reference each other by it’s service name.

In that scenario,

import weaviate
client = weaviate.Client("http://weaviate:8080")
client.is_ready()

should work

However, if you are running Weaviate inside a container, and you app is running locally (which I believe is your scenario), like a script you are executing, you will need to point to

client = weaviate.Client("http://weaviate:8080")

Let me know if that helps!

Thanks!

I’ve just installed Weaviate using pip (so, its up to date) and try to connect locally using your code above. I get the errors:

raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='weaviate', port=8080): Max retries exceeded with url: /v1/.well-known/openid-configuration (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x0000015DD90683D0>: Failed to resolve 'weaviate' ([Errno 11001] getaddrinfo failed)")). 

Well,. its my first experientce with Weaviate. I also got deprecation warning, so I have installed update of the client to v4. but I just installed Weaviate. I am so confused.

hi @Jacck ! Welcome to our community :hugs:

We need more information to be able to help you here.

1 - How are you running Weaviate? Locally? Using our WCS?
2 - Can you share the code you are using?

Thanks!

I would like to try DSPy with Weaviate. Just simple set up. I use latest version of Weaviate on my laptop: 4.5.4. I get DeprecationWarning: Dep016: You are using the Weaviate v3 client, which is deprecated.
Consider upgrading to the new and improved v4 client instead!
See here for usage: Python | Weaviate - Vector Database and errors. I do not get it what should I do just to make simple use case. After line: client = weaviate.Client(“http://weaviate:8080”), i got raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘weaviate’, port=8080): Max retries exceeded with url: /v1/.well-known/openid-configuration (Caused by NameResolutionError(“<urllib3.connection.HTTPConnection object at 0x000001C56ED996C0>: Failed to resolve ‘weaviate’ ([Errno 11001] getaddrinfo failed)”))

finally i figured out the solution

1 Like

Good news! What was it Jacck?

Hi Jacck

I want to know how solve the problem about local client connection refused.
Can I have some help?

hi @jimmy_6 !

Are you having issues on that? Please, open a new thread and provide more infos. thanks!