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

docker compose fails on 1.0.16 #3533

Closed
HAL9KKK opened this issue Aug 23, 2024 · 3 comments
Closed

docker compose fails on 1.0.16 #3533

HAL9KKK opened this issue Aug 23, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@HAL9KKK
Copy link

HAL9KKK commented Aug 23, 2024

Bug Description

after following the guide the following error has been shown:

C:\Users\teiiamu\LLM\Projects\langflow\docker_example>docker compose up
time="2024-08-23T20:38:59+02:00" level=warning msg="C:\\Users\\teiiamu\\LLM\\Projects\\langflow\\docker_example\\docker-compose.yml: `version` is obsolete"
[+] Running 3/3
 ✔ Network docker_example_default       Created                                                                    0.1s
 ✔ Container docker_example-postgres-1  Created                                                                    0.2s
 ✔ Container docker_example-langflow-1  Created                                                                    0.2s
Attaching to langflow-1, postgres-1
postgres-1  |
postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1  |
postgres-1  | 2024-08-23 18:39:01.160 UTC [1] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
postgres-1  | 2024-08-23 18:39:01.167 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1  | 2024-08-23 18:39:01.167 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1  | 2024-08-23 18:39:01.199 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1  | 2024-08-23 18:39:01.261 UTC [29] LOG:  database system was shut down at 2024-08-23 18:35:14 UTC
postgres-1  | 2024-08-23 18:39:01.289 UTC [1] LOG:  database system is ready to accept connections
langflow-1  | Starting Langflow v1.0.16...
langflow-1  | [08/23/24 18:39:19] ERROR    2024-08-23 18:39:19 - ERROR    - main - main.py:103
langflow-1  |                              No module named 'psycopg2'
langflow-1  |                     ERROR    2024-08-23 18:39:19 - ERROR    -   __init__.py:1762
langflow-1  |                              __init__ - Traceback (most recent
langflow-1  |                              call last):
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/starlette/routing.py", line
langflow-1  |                              732, in lifespan
langflow-1  |                                  async with
langflow-1  |                              self.lifespan_context(app) as
langflow-1  |                              maybe_state:
langflow-1  |                                File
langflow-1  |                              "/usr/local/lib/python3.12/context
langflow-1  |                              lib.py", line 210, in __aenter__
langflow-1  |                                  return await anext(self.gen)
langflow-1  |                                         ^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/main.py", line 92,
langflow-1  |                              in lifespan
langflow-1  |                                  initialize_services(fix_migrat
langflow-1  |                              ion=fix_migration,
langflow-1  |                              socketio_server=socketio_server)
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/utils.py"
langflow-1  |                              , line 167, in initialize_services
langflow-1  |                                  raise exc
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/utils.py"
langflow-1  |                              , line 165, in initialize_services
langflow-1  |                                  initialize_database(fix_migrat
langflow-1  |                              ion=fix_migration)
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/database/
langflow-1  |                              utils.py", line 93, in
langflow-1  |                              initialize_database
langflow-1  |                                  database_service:
langflow-1  |                              "DatabaseService" =
langflow-1  |                              get_db_service()
langflow-1  |
langflow-1  |                                      ^^^^^^^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/deps.py",
langflow-1  |                               line 154, in get_db_service
langflow-1  |                                  return
langflow-1  |                              get_service(ServiceType.DATABASE_S
langflow-1  |                              ERVICE, DatabaseServiceFactory())
langflow-1  |                              # type: ignore
langflow-1  |                                         ^^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                              ^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/deps.py",
langflow-1  |                               line 43, in get_service
langflow-1  |                                  return
langflow-1  |                              service_manager.get(service_type,
langflow-1  |                              default)  # type: ignore
langflow-1  |                                         ^^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                              ^^^^^^^^^^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/manager.p
langflow-1  |                              y", line 57, in get
langflow-1  |                                  self._create_service(service_n
langflow-1  |                              ame, default)
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/manager.p
langflow-1  |                              y", line 81, in _create_service
langflow-1  |                                  self.services =
langflow-1  |                              self.factories.create(**dependent_
langflow-1  |                              services)
langflow-1  |
langflow-1  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                              ^^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/database/
langflow-1  |                              factory.py", line 18, in create
langflow-1  |                                  return
langflow-1  |                              DatabaseService(settings_service)
langflow-1  |                                         ^^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                              ^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/database/
langflow-1  |                              service.py", line 46, in __init__
langflow-1  |                                  self.engine =
langflow-1  |                              self._create_engine()
langflow-1  |                                                ^^^^^^^^^^^^^^^^
langflow-1  |                              ^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/langflow/services/database/
langflow-1  |                              service.py", line 64, in
langflow-1  |                              _create_engine
langflow-1  |                                  return create_engine(
langflow-1  |                                         ^^^^^^^^^^^^^^
langflow-1  |                                File "<string>", line 2, in
langflow-1  |                              create_engine
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/sqlalchemy/util/deprecation
langflow-1  |                              s.py", line 281, in warned
langflow-1  |                                  return fn(*args, **kwargs)  #
langflow-1  |                              type: ignore
langflow-1  |                                         ^^^^^^^^^^^^^^^^^^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/sqlalchemy/engine/create.py
langflow-1  |                              ", line 599, in create_engine
langflow-1  |                                  dbapi =
langflow-1  |                              dbapi_meth(**dbapi_args)
langflow-1  |                                          ^^^^^^^^^^^^^^^^^^^^^^
langflow-1  |                              ^^
langflow-1  |                                File
langflow-1  |                              "/app/.venv/lib/python3.12/site-pa
langflow-1  |                              ckages/sqlalchemy/dialects/postgre
langflow-1  |                              sql/psycopg2.py", line 690, in
langflow-1  |                              import_dbapi
langflow-1  |                                  import psycopg2
langflow-1  |                              ModuleNotFoundError: No module
langflow-1  |                              named 'psycopg2'
langflow-1  |
langflow-1  |                     ERROR    2024-08-23 18:39:19 - ERROR    -   __init__.py:1762
langflow-1  |                              __init__ - Application startup
langflow-1  |                              failed. Exiting.
langflow-1  | [08/23/24 18:39:19] ERROR    2024-08-23 18:39:19 - ERROR    -   __init__.py:1762
langflow-1  |                              __init__ - Worker (pid:32) exited
langflow-1  |                              with code 3
langflow-1  |                     ERROR    2024-08-23 18:39:19 - ERROR    -   __init__.py:1762
langflow-1  |                              __init__ - Shutting down: Master
langflow-1  |                     ERROR    2024-08-23 18:39:19 - ERROR    -   __init__.py:1762
langflow-1  |                              __init__ - Reason: Worker failed
langflow-1  |                              to boot.

Reproduction

Steps

  1. Clone the LangFlow repository: git clone https://github.com/langflow-ai/langflow.git
  2. cd langflow/docker_example
  3. docker compose up

Expected behavior

running langflow on port 7860

Who can help?

No response

Operating System

wiindows

Langflow Version

1.0.16

Python Version

None

Screenshot

No response

Flow File

No response

@HAL9KKK HAL9KKK added the bug Something isn't working label Aug 23, 2024
Copy link

dosubot bot commented Aug 23, 2024

I found a similar unsolved discussion regarding the "No module named 'psycopg2'" error in a Docker container [1].

To resolve the "No module named 'psycopg2'" error when running docker compose up for Langflow v1.0.16, you need to ensure that the psycopg2 module is included in the Docker image. This can be done by modifying the Dockerfile to include the installation of psycopg2.

Here is an example of how you can modify the Dockerfile:

  1. Open the Dockerfile used for the langflow service.
  2. Add the installation command for psycopg2.

For example:

FROM langflowai/langflow:1.0.16

# Install psycopg2
RUN pip install psycopg2-binary

# Other Dockerfile instructions...

After modifying the Dockerfile, rebuild the Docker image and then run docker compose up again.

docker compose build
docker compose up

This should resolve the "No module named 'psycopg2'" error [2].

To continue talking to Dosu, mention @dosu.

@italojohnny italojohnny self-assigned this Aug 23, 2024
@italojohnny
Copy link
Member

This issue has just been fixed in PR #3526

@dae-sun
Copy link

dae-sun commented Aug 26, 2024

This issue has just been fixed in PR #3526

It seems that it's not applied to docker file.

For a while, we need to add
RUN pip install psycopg2-binary
in docker_example/Dockerfile,
add build option in docker_example/docker-compose.yml

services:
  langflow:
    image: langflowai/langflow:latest
    build:
      dockerfile: ./Dockerfile

then, docker compose build & docker compose up would be work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants