Undertone0809 / promptulate

🚀Lightweight Large language model automation and Autonomous Language Agents development framework. Build your LLM Agent Application in a pythonic way!
https://promptulate.cn/
Apache License 2.0
334 stars 34 forks source link

ModuleNotFoundError: No module named 'paho' #77

Closed Undertone0809 closed 1 year ago

Undertone0809 commented 1 year ago

I run pne-chat after pip install promptulate. It shows the following error:

Traceback (most recent call last):
  File "/home/zeeland/.local/bin/pne-chat", line 5, in <module>
    from promptulate.client.chat import main
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/client/chat.py", line 28, in <module>
    from promptulate.agents import ToolAgent
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/agents/__init__.py", line 2, in <module>
    from promptulate.agents.tool_agent.agent import ToolAgent
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/agents/tool_agent/__init__.py", line 1, in <module>
    from promptulate.agents.tool_agent.agent import ToolAgent
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/agents/tool_agent/agent.py", line 11, in <module>
    from promptulate.tools import BaseTool, Tool
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/tools/__init__.py", line 10, in <module>
    from promptulate.tools.iot_swith_mqtt import IotSwitchTool
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/tools/iot_swith_mqtt/__init__.py", line 1, in <module>
    from promptulate.tools.iot_swith_mqtt.tools import IotSwitchTool
  File "/home/zeeland/.local/lib/python3.10/site-packages/promptulate/tools/iot_swith_mqtt/tools.py", line 4, in <module>
    import paho.mqtt.client as mqtt
ModuleNotFoundError: No module named 'paho'

import paho is not a good way for developer. I think we should not import paho when initialization.

I think we can import paho when run the tool.

class IotSwitchTool(Tool):

    def _run(self, question: str, *args, **kwargs) -> str:
        import paho.mqtt.client as mqtt
        ...
Undertone0809 commented 1 year ago

There is another error. image

Undertone0809 commented 1 year ago

@ruanrongman

Undertone0809 commented 1 year ago

API wrapper get the same problem. We should import package when run it. image

ruanrongman commented 1 year ago

ok