Weaviate.connect_to_local() error

Hi, I have the problem with connecting weaviate container

I tried to solve it with many topics in here, but it is not solved

the error is this:

Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py”, line 69, in map_httpcore_exceptions
yield
File “/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py”, line 233, in handle_request
resp = self._pool.handle_request(req)
File “/usr/local/lib/python3.9/site-packages/httpcore/_sync/connection_pool.py”, line 216, in handle_request
raise exc from None
File “/usr/local/lib/python3.9/site-packages/httpcore/_sync/connection_pool.py”, line 196, in handle_request
response = connection.handle_request(
File “/usr/local/lib/python3.9/site-packages/httpcore/_sync/connection.py”, line 99, in handle_request
raise exc
File “/usr/local/lib/python3.9/site-packages/httpcore/_sync/connection.py”, line 76, in handle_request
stream = self._connect(request)
File “/usr/local/lib/python3.9/site-packages/httpcore/_sync/connection.py”, line 122, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
File “/usr/local/lib/python3.9/site-packages/httpcore/_backends/sync.py”, line 213, in connect_tcp
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
File “/usr/lib64/python3.9/contextlib.py”, line 137, in exit
self.gen.throw(typ, value, traceback)
File “/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py”, line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 111] Connection refused

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

Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py”, line 258, in _create_clients
response = client.get(oidc_url)
File “/usr/local/lib/python3.9/site-packages/httpx/_client.py”, line 1054, in get
return self.request(
File “/usr/local/lib/python3.9/site-packages/httpx/_client.py”, line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File “/usr/local/lib/python3.9/site-packages/httpx/_client.py”, line 914, in send
response = self._send_handling_auth(
File “/usr/local/lib/python3.9/site-packages/httpx/_client.py”, line 942, in _send_handling_auth
response = self._send_handling_redirects(
File “/usr/local/lib/python3.9/site-packages/httpx/_client.py”, line 979, in _send_handling_redirects
response = self._send_single_request(request)
File “/usr/local/lib/python3.9/site-packages/httpx/_client.py”, line 1015, in _send_single_request
response = transport.handle_request(request)
File “/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py”, line 233, in handle_request
resp = self._pool.handle_request(req)
File “/usr/lib64/python3.9/contextlib.py”, line 137, in exit
self.gen.throw(typ, value, traceback)
File “/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py”, line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/helpers.py”, line 213, in connect_to_local
return __connect(client)
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/helpers.py”, line 401, in __connect
raise e
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/helpers.py”, line 397, in __connect
client.connect()
File “/usr/local/lib/python3.9/site-packages/weaviate/client.py”, line 287, in connect
self._connection.connect(self.__skip_init_checks)
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py”, line 711, in connect
super().connect(skip_init_checks)
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py”, line 138, in connect
self._create_clients(self._auth, skip_init_checks)
File “/usr/local/lib/python3.9/site-packages/weaviate/connect/v4.py”, line 260, in _create_clients
raise WeaviateConnectionError(
weaviate.exceptions.WeaviateConnectionError: Connection to Weaviate failed. Error: [Errno 111] Connection refused.
Is Weaviate running and reachable at http://localhost:8080?

And then, I checked the container logs:

{“action”:“startup”,“error”:“init bolt_db: open "/var/lib/weaviate/schema.db": open /var/lib/weaviate/schema.db: permission denied”,“level”:“fatal”,“msg”:“could not initialize schema repo”,“time”:“2024-06-10T00:48:06Z”}

so, I tried to remove /var/lib/weaviate folder but it can’t

How can I solve this connecting error?
Please, help

my code is simple:

import weaviate
client = weaviate.connect_to_local()
print(“Connecting success”)
client.close()

Hi Jimmy!

Can you share your docker compose?

It seems it doesn’t have permission to write on the path you set for persistence.

try commenting out the volume and check if it will docker compose up.

If that’s the case, you need to check the permission on the mount point or volume you have defined.

Let me know if this helps.

Thanks!