02-Getting-Started-Mac

Getting Started on Mac

Open in Colabarrow-up-rightOpen in GitHubarrow-up-right

Overview

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.

Table of Contents


Opening Terminal

  • Open Spotlight Search by pressing Command + Space .

  • Search for terminal and press Enter to open the Terminal.

Installing Homebrew

Running the Homebrew Installation Command

  • Run the following command in the Terminal to install Homebrew:

  • Enter your account password when prompted.PasswordZ

  • Press ENTER to proceed with the installation.

Configuring Homebrew Environment

  • Run the following command to check your username:

Jupyter Extension
  • 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:

Verifying Xcode Installation

To check if Xcode Command Line Tools are installed, run the following command in your terminal:

Downloading Practice Code

[Reference] Practice code repository: LangChain Practice Codearrow-up-right

Verifying Git Installation

  • 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:

Downloading Practice Code with Git

  • 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.

Installing Pyenv

Reference

For detailed documentation, refer to the Pyenv GitHub Pagearrow-up-right.


Steps to Install Pyenv

  1. Update Homebrew and install pyenv using the following commands:

  2. Add the following lines to your ~/.zshrc file. Copy and paste the commands into your terminal:

  3. If you encounter a permissions error, resolve it by running these commands:

  4. Restart the terminal shell to apply the changes:

Installing Python

  • 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.

Installing Poetry

Reference

For detailed documentation, refer to the Poetry Official Documentationarrow-up-right.


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:

Installing Visual Studio Code

  • Download Visual Studio Code:

  • Install Visual Studio Code:

    • Follow the installation instructions for your system.

    • Dag the application to the Applications folder.

  • Install Extensions:

    • Open Visual Studio Code.

    • Click on the Extensions icon on the left sidebar.Extensions Icon

    • Search for "python" in the Extensions Marketplace and install it.Python Extension

    • Search for "jupyter" in the Extensions Marketplace and install it.Jupyter Extension

  • 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.

Last updated