Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put Langchain on Conda-forge #1271

Closed
darabos opened this issue Feb 24, 2023 · 16 comments
Closed

Put Langchain on Conda-forge #1271

darabos opened this issue Feb 24, 2023 · 16 comments

Comments

@darabos
Copy link

darabos commented Feb 24, 2023

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!)

@stepp1
Copy link
Contributor

stepp1 commented Feb 26, 2023

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.

@stepp1
Copy link
Contributor

stepp1 commented Feb 26, 2023

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

@dlqqq
Copy link
Contributor

dlqqq commented Mar 19, 2023

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.

@Jbollenbacher
Copy link

Jbollenbacher commented Mar 20, 2023

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.

@darabos
Copy link
Author

darabos commented Mar 20, 2023

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.

@dlqqq
Copy link
Contributor

dlqqq commented Mar 20, 2023

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

@dlqqq
Copy link
Contributor

dlqqq commented Mar 20, 2023

I can own this if nobody else is working on it; I've already uploaded Jupyter File ID to Conda Forge in the past.

@dlqqq
Copy link
Contributor

dlqqq commented Mar 20, 2023

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:

  1. Grayskull doesn't parse optional dependencies correctly. Issue: [BUG] Optional pyproject deps have optional added to the version conda/grayskull#440

  2. 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: it is not handling ~ in dependencies conda/grayskull#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 let grayskull 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

@dlqqq
Copy link
Contributor

dlqqq commented Mar 22, 2023

conda-forge/staged-recipes#22366

Happy to announce LangChain on Conda Forge is coming soon. 🎉

@dosubot
Copy link

dosubot bot commented Aug 4, 2023

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.

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Aug 4, 2023
@dlqqq
Copy link
Contributor

dlqqq commented Aug 8, 2023

@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: conda-forge/staged-recipes#22366

@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Aug 8, 2023
@dosubot
Copy link

dosubot bot commented Aug 8, 2023

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?

@baskaryan
Copy link
Collaborator

@dlqqq
Copy link
Contributor

dlqqq commented Aug 9, 2023

Oh, I guess somebody beat me to it, haha. This issue should be marked as closed.

@aparente
Copy link

aparente commented Nov 3, 2023

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.

@blairtj
Copy link

blairtj commented Dec 28, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants