02-Getting-Started-Mac
Last updated
Last updated
Author: JeongHo Shin
Design:
Peer Review:
This is a part of LangChain Open Tutorial
This guide provides a comprehensive setup process tailored for developing with LangChain on a Mac. LangChain is a framework for building applications powered by large language models (LLMs), and this guide ensures your environment is fully optimized for seamless integration and development.
Open Spotlight Search by pressing Command + Space .
Search for terminal and press Enter to open the Terminal.
Run the following command in the Terminal to install Homebrew:
Press ENTER to proceed with the installation.
Run the following command to check your username:
Check the installation path of Homebrew:
Verify the installation path of Homebrew:
Case 1 : If the output is /opt/homebrew/bin/brew , use the following command to configure the environment:
Case 2 : If the output is /usr/local/bin/brew , use the following command:
To check if Xcode Command Line Tools are installed, run the following command in your terminal:
[Reference] Practice code repository: LangChain Practice Code
Check if Git is installed by running the following command in your terminal:
If the command outputs the Git version, you already have Git installed, and no further action is required.
If Git is not installed, you can install it using Homebrew:
After installation, verify Git again:
Navigate to the Documents folder (or any other folder where you want to download the practice code). Use the following command:
If you want to use a different directory, replace Documents with your desired path.
Use the git command to download the practice code from the repository. Run the following command in your terminal:
The repository will be cloned into a folder named LangChain-OpenTutorial within the selected directory.
Reference
For detailed documentation, refer to the Pyenv GitHub Page.
Steps to Install Pyenv
Update Homebrew and install pyenv
using the following commands:
Add the following lines to your ~/.zshrc file. Copy and paste the commands into your terminal:
If you encounter a permissions error, resolve it by running these commands:
Restart the terminal shell to apply the changes:
Use pyenv
to install Python 3.11:
Set Python 3.11 as the global Python version:
Restart the shell to ensure the changes take effect:
Verify the installed Python version:
Ensure the output shows 3.11.
Reference
For detailed documentation, refer to the Poetry Official Documentation.
Steps to Install and Configure Poetry
Install Poetry using pip3
:
Set up a Python virtual environment using Poetry:
Update all Python dependencies in the project:
Download Visual Studio Code:
Visit the Visual Studio Code Download Page.
Download the installer for your operating system.
Install Visual Studio Code:
Follow the installation instructions for your system.
Dag the application to the Applications folder.
Install Extensions:
Open Visual Studio Code.
Restart Visual Studio Code:
After installing the extensions, restart Visual Studio Code to apply the changes.
Select Python Environment:
Click on "Select Kernel" in the top-right corner of Visual Studio Code.
Choose the Python virtual environment you set up earlier.
Note: If your environment does not appear in the list, restart Visual Studio Code.
Now, Visual Studio Code is fully set up and ready for development with Python and Jupyter support.
Enter your account password when prompted.
Click on the Extensions icon on the left sidebar.
Search for "python" in the Extensions Marketplace and install it.
Search for "jupyter" in the Extensions Marketplace and install it.