Deprication Warning

I connected to weaviate using Docker, which seems to work fine.

The only issue is that I get a Deprecation Warning for using v3 when I think I am using v4.

Inside a jupyter notebook I am connecting to my weaviate Docker:

import weaviate
import os
import json

client = weaviate.Client(
    url = "http://localhost:8080",  # Replace with your endpoint
    additional_headers = {
        "X-OpenAI-Api-Key": os.getenv("OPENAI_API_KEY")  # Replace with your inference API key
    }
)

And I get the warning message
[/Users/kon/miniconda3/envs/factcheck-gpt/lib/python3.11/site-packages/weaviate/warnings.py:158](https://file+.vscode-resource.vscode-cdn.net/Users/kon/miniconda3/envs/factcheck-gpt/lib/python3.11/site-packages/weaviate/warnings.py:158): 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: https://weaviate.io/developers/weaviate/client-libraries/python warnings.warn(

although I have installed v4 in this environment I am using:
!pip list | grep weaviate
weaviate-client 4.4.2

for now it works, I can run all the code from the quickstart_end_to_end notebook, but I am still wondering where this warning is coming from.

If you are not utilizing v3 at all, can you consider removing weaviate client v3 globally, if it still exist? I am not an expert on python, but i had similar issues where I had to remove a package globally.

Thanks for that hint, but I could not solve it like that.

It seems that I never installed v3. Neither in my conda pkgs folder nor in my site-packages folder seems to be a v3, but only version 4.4.2

Or what would be your way of finding out if I ever installed it? With pip inside a conda env.

Hi @hebkon you are using the v4 client, but you are connecting using a v3 style method. The older style is there for compatibility as people transition to the new style.

A local v4 connection looks like this:

import weaviate
client = weaviate.connect_to_local()

There is more info about connection methods on this page:

2 Likes

Thanks, that makes sense.

I feel the error message should be better. The code should be able to check which version of the client is installed. If a v4 client is installed, but a v3 method is being used, the error message should say so!

“You appear to be using a v3 method with a v4 client, consider migrating your code to use v4 methods as v3 methods are deprecated.”