Create generative AI apps with LangChain.
You can install your local environment with conda (recommended) or pip. The environment configurations for conda and pip are provided. Please note that if you choose pip as you installation tool, you might need additional tweaking.
If you have any problems with the environment, please raise an issue, where you show the error you got. If you feel confident, please go ahead and create a pull request.
For pip and poetry, make sure you install pandoc in your system. On MacOS use brew:
brew install pandoc
On Ubuntu or Debian linux, use apt:
sudo apt-get install pandoc
On Windows, you can use an installer.
This is the recommended method for installing dependencies. Please make sure you have anaconda installed.
First create the environment for the book that contains all the dependencies:
conda env create --file langchain_ai.yaml --force
The conda environment is called langchain_ai
. You can activate it as follows:
conda activate langchain_ai
Pip is the default dependency management tool in Python. With pip, you should be able to install all the libraries from the requirements file:
pip install -r requirements.txt
If you are working with a slow internet connection, you might see a timeout with pip (this can also happen with conda and pip). As a workaround, you can increase the timeout setting like this:
export PIP_DEFAULT_TIMEOUT=100
There's a docker file for the environment as well. It uses the docker environment and starts an ipython notebook. To use it, first build it, and then run it:
docker build -t new_image .
docker run -it new_image
You should be able to find the notebook in your browser at http://localhost:8080.
Make sure you have poetry installed. On Linux and MacOS, you should be able to use the requirements file:
poetry install
This should take the pyproject.toml
file and install all dependencies.
To run the code validation in ruff, please run
ruff check .
If you find anything amiss with the notebooks or dependencies, please feel free to create a pull request.
If you want to change the conda dependency specification (the yaml file), you can test it like this:
conda env create --file langchain_ai.yaml --force
You can update the pip requirements like this:
pip freeze > requirements.txt
Please make sure that you keep these two ways of maintaining dependencies in sync.
Then make sure, you test the notebooks in the new environment to see that they run.