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

langchain-server: ModuleNotFoundError: No module named 'langchain.cli' #5833

Closed
2 of 14 tasks
firezym opened this issue Jun 7, 2023 · 6 comments · Fixed by #6077
Closed
2 of 14 tasks

langchain-server: ModuleNotFoundError: No module named 'langchain.cli' #5833

firezym opened this issue Jun 7, 2023 · 6 comments · Fixed by #6077

Comments

@firezym
Copy link

firezym commented Jun 7, 2023

System Info

WSL Ubuntu 20.04

langchain 0.0.192
langchainplus-sdk 0.0.4

Who can help?

@agola11

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

Reproduction

I did as instructed in the link
https://python.langchain.com/en/latest/tracing/local_installation.html

pip install langchain --upgrade
langchain-server

Expected behavior

❯ langchain-server
Traceback (most recent call last):
File "/home/usr/miniconda3/envs/dev/bin/langchain-server", line 5, in
from langchain.server import main
File "/home/usr/miniconda3/envs/dev/lib/python3.11/site-packages/langchain/server.py", line 5, in
from langchain.cli.main import get_docker_compose_command
ModuleNotFoundError: No module named 'langchain.cli'

@happyhappy-jun
Copy link

same same issue

mac os
langchain 0.0.193
use poetry for env

@abhinavsood
Copy link

Same issue

RHEL 7
Python 3.8.14 and venv
langchain-0.0.194

@agawronski
Copy link

same issue:
mac os
Python 3.10.9
langchain 0.0.194

@gonzoramos
Copy link

same here
mac os
python 3.11
langchain 0.0.194

@gonzoramos
Copy link

I installed langchain.cli manually and things seems to be working. e.g.

pipenv install langchain.cli

@robertverdes
Copy link

robertverdes commented Jun 11, 2023

@gonzoramos unfortunately that downgrades langchain to 0.0.139. And won't work with 0.0.196.

I suspect langchain.cli (https://pypi.org/project/langchain-cli/) is not the same thing as the orphaned module in server.py:
from langchain.cli.main import get_docker_compose_command

What worked for me locally is to replace server.py with its old working version:

"""Script to run langchain-server locally using docker-compose."""
import subprocess
from pathlib import Path


def main() -> None:
    """Run the langchain server locally."""
    p = Path(__file__).absolute().parent / "docker-compose.yaml"

    subprocess.run(["docker-compose", "-f", str(p), "pull"])
    subprocess.run(["docker-compose", "-f", str(p), "up"])


if __name__ == "__main__":
    main()

hwchase17 pushed a commit that referenced this issue Jun 13, 2023
… (#6077)

This PR fixes the error
`ModuleNotFoundError: No module named 'langchain.cli'`
Fixes #5833 (issue)
Undertone0809 pushed a commit to Undertone0809/langchain that referenced this issue Jun 19, 2023
…gchain-ai#5833 (langchain-ai#6077)

This PR fixes the error
`ModuleNotFoundError: No module named 'langchain.cli'`
Fixes langchain-ai#5833 (issue)
This was referenced Jun 25, 2023
kacperlukawski pushed a commit to kacperlukawski/langchain that referenced this issue Jun 29, 2023
…gchain-ai#5833 (langchain-ai#6077)

This PR fixes the error
`ModuleNotFoundError: No module named 'langchain.cli'`
Fixes langchain-ai#5833 (issue)
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

Successfully merging a pull request may close this issue.

6 participants