AI

How to Install Weaviate CLI

Weaviate is an open-source, cloud-native, decentralized knowledge graph system developed by SeMI Technologies. It is designed to store, search, and retrieve the complex data objects in real-time which allows you to build intelligent applications that leverage the contextual relationships between entities.

Weaviate utilizes a vector-based approach called semantic search to organize and query the data. Weeviate also uses the embedding techniques such as word2vec which maps a word or various entities into a high-dimensional vector space. This approach captures semantic relationships and allows for similarity-based searches.

One way to interact with a Weaviate instance is using the command-line interface called the Weaviate CLI. This command-line utility allows you to connect to the Weaviate server and perform various operations.

It provides a wide set of commands that allows you to execute various operations such as:

  1. Configuration management
  2. Schema creation, modification, deletion, and more
  3. Data import and exports
  4. Entity management
  5. Query execution, and more

Due to its simplistic nature and ease of access, the Weaviate CLI provides a simplified interface to interact with the server. This enhances productivity and allows for automation and integration with workflows.

This tutorial teaches us how to install and configure the Weavitate CLI on your machine using various techniques.

The commands that are provided in this post are demonstrated using Ubuntu 22.04. However, the commands will work on any system with Python being installed.

Install Python

The first step is to ensure that you have Python installed on your machine. At the time of writing this post, the Weaviate CLI requires Python 3.7 and higher.

You can install Python 3 on Ubuntu with the following provided steps.

Update the system repositories by running the following command:

$ sudo apt-get update

Once updated, run the following command to install Python 3.11 on your system:

$ sudo apt-get install python3.11

Upon completion, you can run the following command to verify that you have the correct Python interpreter:

python3.11 --version
Python 3.11.0rc1

If you wish to use Python 11 as the default Python interpreter, you can run the following command:

$ sudo update-alternatives --config python3

This command prompts you to choose the default Python version from the displayed list. Enter the selection number corresponding to Python 3.11 and press “Enter”.

Install the Weaviate CLI

The next step is to install the Weaviate CLI on your machine. Luckily, we have the tool as a Python package which we can quickly install using pip.

You can run the following command to install it on your machine:

$ pip install weaviate-cli

You can also use the “pip3” command to install it:

$ pip3 install weaviate-cli

If you do not have “pip” installed, you can use “apt” with a simple command to install it as follows:

$ sudo apt-get install python3-pip

You can then verify if you have the Weaviate CLI installed correctly using the following command:

$ weaviate version

Weaviate CLI Configuration

The command should return the installed version of the Weaviate CLI. If you get a configuration error, run the following command to initialize the Weaviate CLI.

$ weaviate config set

The previous command prompts you to provide the details to your Weaviate cluster. For example:

No existing configuration found, creating new one.
Please give a weaviate url: https://weaviate-linuxhint-cxvme9nb.weaviate.network
Please select the authentication method:
1) No authentication
2) Client secret
3) Username and password
Enter number: 2
Please specify the client secret:
Config creation complete

Please give a weaviate url: ^C
Aborted!

Once completed, you will have the details of your cluster configured and saved for ease of access and use.

Conclusion

We explored the basics of installing and configuring the Weaviate CLI on your system. We also discussed how to configure the details of the Weaviate cluster on the Weaviate CLI.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list