tsterbak / promptmage

simplifies the process of creating and managing LLM workflows.
https://promptmage.io
MIT License
80 stars 6 forks source link

Docker Error #2

Closed Jay4242 closed 2 months ago

Jay4242 commented 2 months ago

Hello! Thanks for the cool project. I'm trying the docker method, https://github.com/tsterbak/promptmage/tree/main/examples/docker

On my Ubuntu OS I ran sudo docker build -t promptmage-example . several times and it eventually gave a clean output.

Step 1/7 : FROM python:3.11-slim
 ---> 10f461201cdb
Step 2/7 : WORKDIR /app
 ---> Using cache
 ---> b1131d339812
Step 3/7 : COPY . /app
 ---> Using cache
 ---> 8bfe2a4884b4
Step 4/7 : RUN pip install promptmage==0.0.4
 ---> Using cache
 ---> 4db4ee562ac3
Step 5/7 : RUN pip install --no-cache-dir -r requirements.txt
 ---> Using cache
 ---> deee2b7543fa
Step 6/7 : EXPOSE 8000
 ---> Using cache
 ---> 86b6ce05b184
Step 7/7 : CMD ["promptmage", "run", "summarize_article_by_facts.py"]
 ---> Using cache
 ---> 8378be667e64
Successfully built 8378be667e64
Successfully tagged promptmage-example:latest

Although, when I run, sudo docker run -p 8000:8000 -v $(pwd)/.promptmage:/app/.promptmage --env-file ./.env promptmage-example I get the following error,

Traceback (most recent call last):
  File "/usr/local/bin/promptmage", line 8, in <module>
    sys.exit(promptmage())
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/promptmage/cli.py", line 57, in run
    current_flow = get_flow(file_path)
                   ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/promptmage/utils.py", line 13, in get_flow
    module = import_module(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app/summarize_article_by_facts.py", line 4, in <module>
    from promptmage import PromptMage, Prompt, MageResult
ImportError: cannot import name 'MageResult' from 'promptmage' (/usr/local/lib/python3.11/site-packages/promptmage/__init__.py)

I tried copying the summarize_article_by_fact.py from https://github.com/tsterbak/promptmage/tree/main/examples but this didn't seem to help.

Jay4242 commented 2 months ago

Changing line 11 in the Dockerfile to not be promptmage==0.0.4 seemed to solve this.

tsterbak commented 2 months ago

Hey, thanks a lot for your interest in the project :) And thanks for the report! I will fix it now.