# AttributeError: 'WeaviateClient' object has no attribute 'query'

**URL:** <https://forum.weaviate.io/t/attributeerror-weaviateclient-object-has-no-attribute-query/9162>\
**Category:** Support\
**Tags:** python\
**Created:** [December 9, 2024, 8:35am UTC](https://forum.weaviate.io/t/attributeerror-weaviateclient-object-has-no-attribute-query/9162 "2024-12-09T08:35:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaan\_Tiftikci](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/kaan_tiftikci/32/3126_2.png) [@Kaan\_Tiftikci](https://forum.weaviate.io/u/Kaan_Tiftikci)\
**Post date:** [December 9, 2024, 8:35am UTC](https://forum.weaviate.io/t/attributeerror-weaviateclient-object-has-no-attribute-query/9162/1 "2024-12-09T08:35:38Z")

</div>

hello,

I am using weaviate-client==4.9.6 and I am getting the error AttributeError: ‘WeaviateClient’ object has no attribute ‘query’. When I run it with visual studio on my Windows device, I do not get such an error, but when I try to run it with visual studio and colab on my macOS device, I encounter this error. In which version can I use query? I would be very happy if you could help me.

Thanks

---

<div class="post-metadata">

**Author:** ![andrewisplinghoff](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/andrewisplinghoff/32/1853_2.png) [@andrewisplinghoff](https://forum.weaviate.io/u/andrewisplinghoff)\
**Post date:** [December 9, 2024, 1:29pm UTC](https://forum.weaviate.io/t/attributeerror-weaviateclient-object-has-no-attribute-query/9162/2 "2024-12-09T13:29:14Z")

</div>

That sounds to me like in the installation where you are getting the error, you are using the current Python v4 API (as you mention, you retrieve a `WeaviateClient`object which is the case when using the v4 API).

In the v4 API, `query()` is to be called on `Collection` instances as described here:

> **[Migrate from v3 to v4 | Weaviate](https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration#interact-with-collections)**
>
> The current Python client version is v||site.pythonclientversion||

If you want to keep using your old code with the v3 API, you need to create instances of the deprecated `weaviate.Client()`. You can find details on that here:

[Legacy (v3) API (DEPRECATED) | Weaviate](https://weaviate.io/developers/weaviate/client-libraries/python/python_v3)

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [December 9, 2024, 1:29pm UTC](https://forum.weaviate.io/t/attributeerror-weaviateclient-object-has-no-attribute-query/9162/3 "2024-12-09T13:29:54Z")

</div>

hi @Kaan_Tiftikci !!

Welcome to our community 🤗

Can you share the code you are using? It seems like you are using different client versions.

This is python v3 client:

```python
v3c = weaviate.Client("http://localhost:8080")
v3c.query.get("Test", "text").do()

```

and this is the python v4 client:

```python
client = weaviate.connect_to_local()
collection = client.collections.get("Test")
collection.query.fetch_objects().objects

```

Note that the python v3 client is included in the python v4 client package. However, it is deprecated, a will be removed in future versions. Right now, if you instantiate a v3 client using the v4 client package, this warning will be printed:

> DeprecationWarning:  
> Python client v3 `weaviate.Client(...)` connections and methods are deprecated and will  
> be removed by 2024-11-30.
> 
> ```
> Upgrade your code to use Python client v4 `weaviate.WeaviateClient` connections and methods.
> - For Python Client v4 usage, see: https://weaviate.io/developers/weaviate/client-libraries/python
> - For code migration, see: https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration
> 
> If you have to use v3 code, install the v3 client and pin the v3 dependency in your requirements file: `weaviate-client>=3.26.7;<4.0.0`
> 
> ```

So this exact error you mentioned will surface when you call `.query` on the python v4 client:

```python
client.query

```

> AttributeError Traceback (most recent call last) Cell In[9], line 1 ----\> 1 client.query AttributeError: ‘WeaviateClient’ object has no attribute ‘query’

Let me know if this helps!

---

<div class="post-metadata">

**Author:** ![Dirk](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dirk/32/46_2.png) [@Dirk](https://forum.weaviate.io/u/Dirk)\
**Post date:** [December 9, 2024, 1:43pm UTC](https://forum.weaviate.io/t/attributeerror-weaviateclient-object-has-no-attribute-query/9162/4 "2024-12-09T13:43:11Z")

</div>

> [@DudaNogueira](#):
>
> However, it is deprecated, a will be removed in future versions

I just deleted it, it will be gone in the next release (4.10.0)
