Apple’s M1 Macs, with their advanced ARM architecture, offer incredible performance and energy efficiency. However, users may encounter some strange issues when installing certain software due to architecture compatibility. One such software is the ChatGPT Retrieval Plugin from OpenAI. This guide will walk you through the steps to successfully install and run the ChatGPT Retrieval Plugin on your M1 Mac.
Understanding the Challenge
The main issue arises from the fact that many Python packages, including those required by the ChatGPT Retrieval Plugin, are designed for x86 architecture used by Intel processors. When these packages are installed on an M1 Mac, they need to be translated to ARM architecture, leading to performance penalties. Therefore, the goal is to set up a Python environment that supports ARM architecture natively, eliminating the need for translation.
Step 1: Install Homebrew
Homebrew is a package manager for macOS that simplifies the installation of software on your Mac. To install Homebrew, open the Terminal app and enter the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2: Install Miniforge
Miniforge is a distribution of the Conda package manager that supports ARM architecture. It provides precompiled binaries for many Python packages, ensuring they run efficiently on your M1 Mac. To install Miniforge, use the following commands in your Terminal:
Step 3: Create a New Conda Environment
Close and reopen your terminal (important), then create a new Conda environment with the correct architecture. This environment will be used to install the Python packages required by the ChatGPT Retrieval Plugin. Use the following command to create a new environment named “chatgpt”:
conda create --name chatgpt python=3.10
Step 4: Activate the Conda Environment
Before installing the packages, you need to activate the newly created environment. Use the following command:
conda activate chatgpt
Step 5: Clone the Repository and Install Dependencies
Now, you’re ready to clone the ChatGPT Retrieval Plugin repository and install its dependencies. First, clone the repository from GitHub:
git clone https://github.com/openai/chatgpt-retrieval-plugin.git
Then, navigate to the cloned repository’s directory:
Install the required packages:
Step 6: Set Up Environment Variables
Before running the plugin, you need to set up some environment variables. These include your OpenAI API key, a bearer token, and the details of your chosen vector database. The exact variables you need to set will depend on the vector database you’re using. You can find more information about setting up each vector database in the ChatGPT Retrieval Plugin repository.
Step 7: Run the Plugin
Finally, you can run the ChatGPT Retrieval Plugin. Use the following command:
poetry run start
Congratulations! You’ve successfully installed and are now running the ChatGPT Retrieval Plugin on your M1 Mac.
While the process of installing the ChatGPT Retrieval Plugin on an M1 Mac may seem daunting at first, following these steps will ensure a smooth installation process. Remember, the key is to set up a Python environment thatsupports ARM architecture natively, which is achieved by using Miniforge, a distribution of the Conda package manager that supports ARM architecture.