langchain
langchain copied to clipboard
Put Langchain on Conda-forge
We manage all our dependencies with a Conda environment file. It would be great if that could cover Langchain too! As Langchain is taking off, there are probably other Conda users in the same shoes.
(Thanks for making Langchain! It's great!)
Using grayskull, we can get a possible recipe by running:
grayskull pypi --strict-conda-forge langchain
However, some dependencies are not on conda-forge channels (see list at the end of comment). I don't really know if that's an issue.
aleph-alpha-client
google-search-results
nlpcloud
cohere
tensorflow-text
qdrant-client
manifest-ml
tiktoken
pinecone-client
weaviate-client
wolframalpha
qdrant-client
anthropic
tensorflow-text
Edit: According conda-forge recipe FAQ all packages must be in some channel.
For completeness, here's the meta.yaml
generated by grayskull
{% set name = "langchain" %}
{% set version = "0.0.94" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/langchain-{{ version }}.tar.gz
sha256: de1efe486893f2064748366747471854f316a6e9790c0fb6646b8c2e8ed6153f
build:
entry_points:
- langchain-server = langchain.server:main
noarch: python
script: {{ PYTHON }} -m pip install . -vv
number: 0
requirements:
host:
- python >=3.8,<4.0
- poetry-core
- pip
run:
- python >=3.8.1,<4.0
- pydantic ^1
- sqlalchemy ^1
- requests ^2
- pyyaml ^6
- numpy ^1
- faiss-cpu ^1optionaltrue
- wikipedia ^1optionaltrue
- elasticsearch ^8optionaltrue
- opensearch-py ^2.0.0optionaltrue
- redis-py ^4optionaltrue
- manifest-ml ^0.0.1optionaltrue
- spacy ^3optionaltrue
- nltk ^3optionaltrue
- transformers ^4optionaltrue
- beautifulsoup4 ^4optionaltrue
- pytorch ^1optionaltrue
- jinja2 ^3optionaltrue
- tiktoken ^0optionaltrue
- pinecone-client ^2optionaltrue
- weaviate-client ^3optionaltrue
- google-api-python-client ==2.70.0optionaltrue
- wolframalpha ==5.0.0optionaltrue
- anthropic ^0.2.2optionaltrue
- qdrant-client ^0.11.7optionaltrue
- dataclasses-json ^0.5.7
- tensorflow-text ^2.11.0optionaltrue
- tenacity ^8.1.0
- cohere ^3optionaltrue
- openai ^0optionaltrue
- nlpcloud ^1optionaltrue
- huggingface_hub ^0optionaltrue
- google-search-results ^2optionaltrue
- sentence-transformers ^2optionaltrue
- aiohttp ^3.8.3
- pypdf ^3.4.0optionaltrue
- networkx ^2.6.3optionaltrue
- aleph-alpha-client ^2.15.0
test:
imports:
- langchain
commands:
- pip check
- langchain-server --help
requires:
- pip
about:
home: https://www.github.com/hwchase17/langchain
summary: Building applications with LLMs through composability
license: MIT
license_file: LICENSE
extra:
recipe-maintainers:
- stepp1
What's the motivation for publishing a package on Conda Forge in addition to PyPi? I've asked around and it seems unclear what exact benefit this offers users.
what [is the] exact benefit this offers users[?]
Basically it allows you to install and uninstall it with conda. The main motivation for using conda (personally) is that makes it much easier to manage multiple python environments on the same machine. I frequently have 5+ active projects, all with their own dependency constraints, and conda makes it easy to handle that. This is a typical problem for data scientists and lots of other applied ML workers who'd be interested in LangChain.
IMO, being listed on both pypi and conda-forge is just part of being a mature package in the python ecosystem. LangChain is getting there, and will need to do this soon.
For us, we manage all dependencies from zip
and make
to openjdk
and pandas
with Conda. Even R packages. (Our conda-env.yml.) It makes it much easier for a new contributor to get set up.
I see. I wanted to make sure that there wasn't an obvious practical benefit I was missing, aside from being able to use exclusively conda install *
.
I can own this if nobody else is working on it; I've already uploaded Jupyter File ID to Conda Forge in the past.
I did a little bit of digging and this is actually a bit more involved than I had anticipated. Grayskull, the utility used to generate recipes, doesn't actually provide out-of-the-box support for our project for 2 main reasons:
-
Grayskull doesn't parse optional dependencies correctly. Issue: https://github.com/conda/grayskull/issues/440
-
Grayskull doesn't recognize Poetry-specific version clauses like
^
or~
, which are non-standard and not present in PEP 440 -- Version Identification and Dependency Specification. Issue: https://github.com/conda/grayskull/issues/441
You can see this clearly in the meta.yaml
output @stepp1 posted; openai ^0optionaltrue
certainly doesn't look like a well-formed requirement listing 😁
The next steps are either to:
-
Modify our
pyproject.toml
to letgrayskull
play nice- This isn't necessarily possible, since I don't know of any other way to specify an optional dependency
-
Cut a PR to
grayskull
to fix it
https://github.com/conda-forge/staged-recipes/pull/22366
Happy to announce LangChain on Conda Forge is coming soon. 🎉
- Branch I used to build the recipe correctly: https://github.com/conda/grayskull/pull/454
Hi, @darabos. I'm helping the LangChain team manage their backlog and I wanted to let you know that we are marking this issue as stale.
Based on the comments, it seems that the issue has been resolved. Langchain is now available on Conda Forge, making it easier for Conda users to manage dependencies. Initially, there were some complications with grayskull, but dlqqq was able to resolve them and successfully publish Langchain on Conda Forge.
Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repo. If you do respond, the LangChain team will take a look. Otherwise, the issue will be automatically closed in 7 days.
Thank you for your understanding.
@dosu-beta Please don't close this issue; LangChain is still not on Conda Forge as of yet. I'll follow up with the LangChain team to see if we can make progress on this.
The PR for uploading LangChain onto Conda Forge remains open: https://github.com/conda-forge/staged-recipes/pull/22366
I'm sorry you're still having trouble with the LangChain repository not being available on Conda Forge. It seems that the PR for uploading LangChain onto Conda Forge is still open. @baskaryan, can you please help @dlqqq with this issue?
believe we are in there: https://github.com/conda-forge/staged-recipes/pull/22515 https://anaconda.org/conda-forge/langchain
cc @hinthornw
Oh, I guess somebody beat me to it, haha. This issue should be marked as closed.
I'm getting this error when trying to install langchain from conda, using the command on the install page:
conda install langchain -c conda-forge
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- langchain
Current channels:
- https://conda.anaconda.org/conda-forge/osx-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
As per the langchain install instructions (the conda tab), you have to specify the conda-forge channel:
conda install langchain -c conda-forge
There are different package versions such as: langchain, langchain-community, and others.