Showing posts with label Dependencies. Show all posts
Showing posts with label Dependencies. Show all posts

Sunday, July 07, 2024

How to set specific version of dependency in poetry

I am here will set langchain-core==0.2.2 instead of 0.2.3 sent in toml file.

To set Poetry to use langchain-core==0.2.2, you can add it as a dependency in your pyproject.toml file. Here's how you can do it:

  1. Open your pyproject.toml file in your project directory.
  2. Locate the [tool.poetry.dependencies] section.
  3. Add the following line to specify the version of langchain-core you want to use: langchain-core = "==0.2.2"
  4. Save the pyproject.toml file.

After making this change, Poetry will use langchain-core==0.2.2 when you run poetry install or poetry update.

Note: Make sure you have Poetry installed on your system before running these commands. You can install Poetry by following the instructions on the official Poetry website.

Sunday, January 21, 2024

How to Create and Pip Install Requirements.txt in Python

Many projects rely on libraries and other dependencies, and installing each one can be tedious and time-consuming.

This is where a ‘requirements.txt’ file comes into play. requirements.txt is a file that contains a list of packages or libraries needed to work on a project that can all be installed with the file. It provides a consistent environment and makes collaboration easier. 'requirements.txt' ensures consistent environment and facilitating collaboration.

Key Points:

  1. Importance of Dependencies: Dependencies are crucial software components required for a program to run correctly. They can be libraries, frameworks, or other programs.

  2. Purpose of 'requirements.txt': It contains a list of packages or libraries needed for a project, allowing for their easy installation while ensuring a consistent environment for collaborative work.

  3. Creating a 'requirements.txt' file: It involves setting up a virtual environment and using the command 'pip freeze > requirements.txt' to capture the list of installed packages and their versions.

  4. Working with a 'requirements.txt' file: After creating the file, the listed dependencies can be installed using the command. 'pip install -r requirements.txt'.

  5. Benefits of 'requirements.txt': It simplifies managing dependencies, aids in sharing projects with others by ensuring easy installation of required packages, and helps maintain consistency in package versions across different environments.