Installation AutoGPT on Mac M1
All other tutorials did not work for me soo I started at the beginning and wrote my own. Therefore this article is intended for people, who want to try out AutoGPT with a OpenAI API Key.
Step by Step Tutorial
Here you will find a step by step tutorial how to use and install Auto-GPT
1.Step get source code for AutoGPT
Clone The AutoGPT Repository: https://github.com/Significant-Gravitas/Auto-GPT . You con download the zip manually or just do it over the command line via:
$ git clone https://github.com/Significant-Gravitas/Auto-GPT.git
2.Step Create a virtual environment
We need a virtual environment because of of the dependencies for python. Therefore we are using anaconda. To install it on Mac follow https://docs.anaconda.com/free/anaconda/install/mac-os/ . After the installation just do:
$ conda create -n env99 python=3.11
The installation may ask you about confirming some stuff just agree.
3.Step activate virtual environment
You can now activate the virtual environment with:
$ conda activate env99
4.Step install AutoGPT:
Now after the activation of the virtual environment you are ready to install the requirements. Therefore use the following:
$ cd Auto-GPT/
$ pip install -r requirements.txt
5.Step the Problem
The problem is during the installation I run into this issue here:
$ … ERROR: Failed building wheel for lxml
Or
$ …error: could not build wheels for lxml, which is required to install pyproject.toml-based projects
Or
$ …error: legacy-install-failure
Or
$ … clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
error: command ‘/usr/local/opt/llvm/bin/clang’ failed with exit code 1
Here is a screenshot:
5.1 Step Solution:
What did the trick for me just run the following:
$ pip install https://github.com/lxml/lxml/releases/download/lxml-4.9.2/lxml-4.9.2-cp311-cp311-macosx_10_15_universal2.whl
6.Step Restarting the Installation
Now that we fixed the lxml dependency we can just rerun the installation command:
$ pip install -r requirements.txt
If it completely successfully it should look something like this:
7. Step get the OpenAI API Key
You can get the Api key here: https://platform.openai.com/account/api-keys
Just click on the button “+ new secret key”.
Give the Api key a name:
Copy the API key:
Save the api key somewhere we need it later.
8. Step add API Key to AutoGPT
Open the the folder Auto-GPT in der Finder. Copy the .env.template file. And Rename the copy of the file to “.env”. If you want to do that via cli just do the following:
$ cd ./Auto-GPT
Of cause if you have already been in your Auto-GPT folder you can skip the above step and only execute this one here:
$ cp ./.env.template ./.env
Now we can go on and edit the just created .env file with vim or sudo. Therefore use the following:
$ nano ./.env
Find the position where it says the “OPENAI_API_KEY=“ and modify it to:
OPENAI_API_KEY=sk-hisfe942389h432h59834ht8439th42389thfweo
IMPORTANT: Here you need to add your api key you created before.
Save the file via keyboard [CONTROL] + O and afterwards press ENTER and exit nano via [CONTROL] + X
9. Step Start Auto-GPT
When you made it until here you are ready to lunch Auto-GPT. Therefore just use the following command to start Auto-GPT:
$ python -m autogpt
Afterwards you should see something like the following screenshot.
In the end after you answered basic questions it will ask you to give it a task:
An example would be “Research the most sold smartphones in 2019”.
And it would start searching the internet about the information. And completed the task writing into a text file a list of the most soled smartphones in 2019.
Conclusion:
I hope you liked the article and it help you. Happy coding.