microsoft / promptflow

Build high-quality LLM apps - from prototyping, testing to production deployment and monitoring.
https://microsoft.github.io/promptflow/
MIT License
8.43k stars 725 forks source link

[BUG]When running the project using Docker, an exception occurs: "Connection 'xxxxxxx' is not found." #1841

Closed chenyugithub365 closed 4 months ago

chenyugithub365 commented 4 months ago

Describe the bug Hello everyone, after completing my PromptFlow, I tried to deploy it using Docker but encountered an issue: "Connection 'xxxxxxx' is not found."

How To Reproduce the bug 1.Build command used: pf flow build --source "D:\work\source code\AIGC_Flow\chat" --output dist --format docker 1 构建的文件

2.Connection configuration has been created. 2 连接

3.Details of the connection configuration. 3 连接的配置内容

4.Dependency package check for the Docker image. 4 依赖包检查

5.Error encountered when calling the Docker image after it is started. 5 调用错误

6.Logs of the Docker image after it is started. logs.txt

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Running Information(please complete the following information):

Additional context Add any other context about the problem here.

YingChen1996 commented 4 months ago

Hi, @chenyugithub365 , thanks for reporting the issue, could you please share your build dockerfile and run file in runit?

chenyugithub365 commented 4 months ago

Hello, @YingChen1996 , you need the Dockerfile and runit file, right? These files are unmodified and generated by Promptflow. runit.zip Dockerfile.txt

YingChen1996 commented 4 months ago

according to the run, it seems you will create connection in the container image

But according to the log.txt there're no connection creation process like below: image

your log: image

But I can't repro the issue, could you please share your example flow? I want to check it's docker environment issue or flow issue.

YingChen1996 commented 4 months ago

btw, make sure docker run your container like below to set your connection key: image

chenyugithub365 commented 4 months ago

I can provide the project code and the complete built files, but I have desensitized some files: dist\connections and chat\python_enterprise_website_knowledge_search.py and dist\flow\python_enterprise_website_knowledge_search.py. I don't think this should affect the troubleshooting of the problem.

chat.zip dist.zip

The command to start the Docker image is: docker run -p 8080:8080 -e AZURE_OPENAI_JAPANEAST_API_KEY=xxx -e AZURE_OPENAI_WESTUS_API_KEY=xxx -d chat:latest

YingChen1996 commented 4 months ago

it seems there're typo in your requirements.txt pywin32==306: not match version, actually docker is for linux/mac environment.

For the issue, I can repro now. I think maybe it's because some package issue. When I only keep the 2 packages in requirement.txt, it can create connection successfully. I will follow up with folks to continue investigate. image

image

YingChen1996 commented 4 months ago

the root cause is that kering_pass.cfg is not generated by keyrings.alt, maybe you need double check your package list in requirement.txt image

correct one should be image

chenyugithub365 commented 4 months ago

Great, your discovery is excellent. It seems that too many dependency packages were imported. I exported all the packages in the virtual environment. The dependency packages pywin32==306 and pywin32-ctypes==0.2.2 were manually removed when creating the image, so there was no impact.

I will reduce the number of dependency packages.

chenyugithub365 commented 4 months ago

Hi, @YingChen1996 , I have successfully resolved the issue based on your guidance. The solution is to streamline the dependencies configured in the requirements.txt file (in fact, only promptflow and promptflow-tools need to be retained). Thank you very much.