Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 311 additions & 0 deletions 01-BASIC/01. Follow the Installation Video_Mac.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "635d8ebb",
"metadata": {},
"source": [
"# Environment Setup (Mac)\n",
"\n",
"- Author: [Jeongho Shin](https://github.com/ThePurpleCollar)\n",
"- Design:\n",
"- Peer Review: [Jeongki Park](https://github.com/jeongkpa), [Wooseok-Jeong](https://github.com/jeong-wooseok)\n",
"- This is a part of [LangChain Open Tutorial](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial)\n",
"\n",
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/langchain-ai/langchain-academy/blob/main/module-4/sub-graph.ipynb) [![Open in LangChain Academy](https://cdn.prod.website-files.com/65b8cd72835ceeacd4449a53/66e9eba12c7b7688aa3dbb5e_LCA-badge-green.svg)](https://academy.langchain.com/courses/take/intro-to-langgraph/lessons/58239937-lesson-2-sub-graphs)\n",
"\n",
"## Overview\n",
"\n",
"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.\n",
"\n",
"# Table of Contents\n",
"\n",
"- [Overview](#overview)\n",
"- [Opening Terminal](#opening-terminal)\n",
"- [Installing Homebrew](#installing-homebrew)\n",
"- [Verifying Xcode Installation](#verifying-xcode-installation)\n",
"- [Downloading Practice Code](#downloading-practice-code)\n",
"- [Python and Environment Configuration](#python-and-environment-configuration)\n",
"- [Development Tools Setup](#development-tools-setup)\n",
"\n",
"----"
]
},
{
"cell_type": "markdown",
"id": "0a630f46",
"metadata": {},
"source": [
"## Opening Terminal\n",
"- Open Spotlight Search by pressing `Command + Space`.\n",
"\n",
"- Search for **`terminal`** and press Enter to open the Terminal."
]
},
{
"cell_type": "markdown",
"id": "edd88e38",
"metadata": {},
"source": [
"## Installing Homebrew\n",
"\n",
"### Running the Homebrew Installation Command\n",
"- Run the following command in the Terminal to install Homebrew:\n",
" ```bash\n",
"\n",
" /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n",
"\n",
"- Enter your account password when prompted.\n",
"<br>\n",
" ![PasswordZ](assets/01-Follow-the-Installation-Video_Mac-01.png)\n",
" \n",
"- Press ENTER to proceed with the installation."
]
},
{
"cell_type": "markdown",
"id": "913b58a6",
"metadata": {},
"source": [
"### Configuring Homebrew Environment\n",
"\n",
"- Run the following command to check your username:\n",
" ```bash\n",
" \n",
" whoami\n",
"![Jupyter Extension](assets/01-Follow-the-Installation-Video_Mac-02.png)\n",
"\n",
"- Check the installation path of Homebrew:\n",
" ```bash\n",
"\n",
" which brew\n",
"\n",
"- Verify the installation path of Homebrew:\n",
" - **Case 1** : If the output is `/opt/homebrew/bin/brew`, use the following command to configure the environment:\n",
" ```bash\n",
" echo 'eval \"$(/opt/homebrew/bin/brew shellenv)\"' >> /Users/<your-username>/.zprofile\n",
"\n",
" - **Case 2** : If the output is `/usr/local/bin/brew`, use the following command:\n",
" ```bash\n",
" echo 'eval \"$(/usr/local/bin/brew shellenv)\"' >> /Users/<your-username>/.zprofile"
]
},
{
"cell_type": "markdown",
"id": "05b6427c",
"metadata": {},
"source": [
"## Verifying Xcode Installation\n",
"\n",
"To check if Xcode Command Line Tools are installed, run the following command in your terminal:\n",
"\n",
"```bash\n",
"xcode-select --install\n"
]
},
{
"cell_type": "markdown",
"id": "070b418b",
"metadata": {},
"source": [
"## Downloading Practice Code\n",
"\n",
"[Reference] Practice code repository: [LangChain Practice Code](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial)\n",
"\n",
"\n",
"### Verifying Git Installation\n",
"\n",
"- Check if Git is installed by running the following command in your terminal:\n",
" ```bash\n",
" git --version\n",
"\n",
"- If the command outputs the Git version, you already have Git installed, and no further action is required.\n",
"\n",
"- If Git is not installed, you can install it using Homebrew:\n",
" ```bash\n",
" brew install git\n",
"\n",
"- After installation, verify Git again:\n",
" ```bash\n",
" git --version\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "3c41318e",
"metadata": {},
"source": [
"### Downloading Practice Code with Git\n",
"- Navigate to the `Documents` folder (or any other folder where you want to download the practice code). Use the following command:\n",
" ```bash\n",
" cd Documents\n",
"- If you want to use a different directory, replace Documents with your desired path.\n",
"\n",
"- Use the `git` command to download the practice code from the repository. Run the following command in your terminal:\n",
" ```bash\n",
" git clone https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial.git\n",
"![](assets/01-Follow-the-Installation-Video_Mac-03.png) \n",
"\n",
"\n",
"- The repository will be cloned into a folder named LangChain-OpenTutorial within the selected directory.\n"
]
},
{
"cell_type": "markdown",
"id": "b9df2082",
"metadata": {},
"source": [
"## Installing Pyenv\n",
"\n",
"#### Reference\n",
"For detailed documentation, refer to the [Pyenv GitHub Page](https://github.com/pyenv/pyenv?tab=readme-ov-file#understanding-python-version-selection).\n",
"\n",
"---\n",
"\n",
"#### Steps to Install Pyenv\n",
"\n",
"1. Update Homebrew and install `pyenv` using the following commands:\n",
" ```bash\n",
" brew update\n",
" brew install pyenv\n",
"\n",
"2. Add the following lines to your ~/.zshrc file. Copy and paste the commands into your terminal:\n",
" ```bash\n",
" echo 'export PYENV_ROOT=\"$HOME/.pyenv\"' >> ~/.zshrc\n",
" echo '[[ -d $PYENV_ROOT/bin ]] && export PATH=\"$PYENV_ROOT/bin:$PATH\"' >> ~/.zshrc\n",
" echo 'eval \"$(pyenv init -)\"' >> ~/.zshrc\n",
"\n",
"3. If you encounter a permissions error, resolve it by running these commands:\n",
" ```bash\n",
" sudo chown $USER ~/.zshrc\n",
" echo 'export PYENV_ROOT=\"$HOME/.pyenv\"' >> ~/.zshrc\n",
" echo '[[ -d $PYENV_ROOT/bin ]] && export PATH=\"$PYENV_ROOT/bin:$PATH\"' >> ~/.zshrc\n",
" echo 'eval \"$(pyenv init -)\"' >> ~/.zshrc\n",
"\n",
"4. Restart the terminal shell to apply the changes:\n",
" ```bash\n",
" exec \"$SHELL\"\n"
]
},
{
"cell_type": "markdown",
"id": "25f630fc",
"metadata": {},
"source": [
"## Installing Python\n",
"\n",
"- Use `pyenv` to install Python 3.11:\n",
" ```bash\n",
" pyenv install 3.11\n",
"\n",
"- Set Python 3.11 as the global Python version:\n",
" ```bash\n",
" pyenv global 3.11\n",
"\n",
"- Restart the shell to ensure the changes take effect:\n",
" ```bash\n",
" exec zsh\n",
"\n",
"- Verify the installed Python version:\n",
" ```bash\n",
" python --version\n",
"\n",
"- Ensure the output shows 3.11."
]
},
{
"cell_type": "markdown",
"id": "8ad5c336",
"metadata": {},
"source": [
"## Installing Poetry\n",
"\n",
"#### Reference\n",
"For detailed documentation, refer to the [Poetry Official Documentation](https://python-poetry.org/docs/#installing-with-the-official-installer).\n",
"\n",
"---\n",
"\n",
"#### Steps to Install and Configure Poetry\n",
"\n",
"- Install Poetry using `pip3`:\n",
" ```bash\n",
" pip3 install poetry\n",
"\n",
"- Set up a Python virtual environment using Poetry:\n",
" ```bash\n",
" poetry shell\n",
"\n",
"- Update all Python dependencies in the project:\n",
" ```bash\n",
" poetry update\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "d539f569",
"metadata": {},
"source": [
"## Installing Visual Studio Code\n",
"\n",
"- **Download Visual Studio Code**:\n",
" - Visit the [Visual Studio Code Download Page](https://code.visualstudio.com/download).\n",
" - Download the installer for your operating system.\n",
"\n",
"- **Install Visual Studio Code**:\n",
" - Follow the installation instructions for your system.\n",
" - On macOS, drag the application to the `Applications` folder.\n",
"\n",
"- **Install Extensions**:\n",
" - Open Visual Studio Code.\n",
" - Click on the **Extensions** icon on the left sidebar.\n",
"\n",
" ![Extensions Icon](assets/01-Follow-the-Installation-Video_Mac-04.png)\n",
"\n",
" - Search for **\"python\"** in the Extensions Marketplace and install it.\n",
"\n",
" ![Python Extension](assets/01-Follow-the-Installation-Video_Mac-05.png)\n",
"\n",
" - Search for **\"jupyter\"** in the Extensions Marketplace and install it.\n",
"\n",
" ![Jupyter Extension](assets/01-Follow-the-Installation-Video_Mac-06.png)\n",
"\n",
"- **Restart Visual Studio Code**:\n",
" - After installing the extensions, restart Visual Studio Code to apply the changes.\n",
"\n",
"- **Select Python Environment**:\n",
" - Click on **\"Select Kernel\"** in the top-right corner of Visual Studio Code.\n",
" - Choose the Python virtual environment you set up earlier.\n",
"\n",
" - **Note**: If your environment does not appear in the list, restart Visual Studio Code again.\n",
"\n",
"---\n",
"\n",
"Now, Visual Studio Code is fully set up and ready for development with Python and Jupyter support.\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "langchain-opentutorial-i-KKkGhc-py3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading