Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.13k stars 935 forks source link

AttributeError: module 'select' has no attribute 'epoll'. #31

Closed pedrobuenoxs closed 1 year ago

pedrobuenoxs commented 1 year ago

``Hey, i'm not able to run chainlit on my computer.

I just grab the demo code:

import chainlit as cl

@cl.on_message  # this function will be called every time a user inputs a message in the UI
def main(message: str):
    # this is an intermediate step
    cl.Message(author="Tool 1", content=f"Response from tool1", indent=1).send()

    # send back the final answer
    cl.Message(content=f"This is the final answer").send()

And run:

❯ chainlit run demo.py -w 
2023-06-02 14:48:47 - Created default config file at /home/pedro/dev/freela/ai-langchain-chatgpt-bot/.chainlit/config.toml
Traceback (most recent call last):
  File "/home/pedro/.local/bin/chainlit", line 5, in <module>
    from chainlit.cli import cli
  File "/home/pedro/.local/lib/python3.10/site-packages/chainlit/__init__.py", line 8, in <module>
    monkey.patch()
  File "/home/pedro/.local/lib/python3.10/site-packages/chainlit/lc/monkey.py", line 9, in patch
    import langchain
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/__init__.py", line 6, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import (
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/agents/agent.py", line 15, in <module>
    from langchain.agents.tools import InvalidTool
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/agents/tools.py", line 8, in <module>
    from langchain.tools.base import BaseTool, Tool, tool
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/tools/__init__.py", line 27, in <module>
    from langchain.tools.playwright import (
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/tools/playwright/__init__.py", line 3, in <module>
    from langchain.tools.playwright.click import ClickTool
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/tools/playwright/click.py", line 11, in <module>
    from langchain.tools.playwright.base import BaseBrowserTool
  File "/home/pedro/.local/lib/python3.10/site-packages/langchain/tools/playwright/base.py", line 15, in <module>
    from playwright.async_api import Browser as AsyncBrowser
  File "/home/pedro/.local/lib/python3.10/site-packages/playwright/async_api/__init__.py", line 25, in <module>
    import playwright.async_api._generated
  File "/home/pedro/.local/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 25, in <module>
    from playwright._impl._accessibility import Accessibility as AccessibilityImpl
  File "/home/pedro/.local/lib/python3.10/site-packages/playwright/_impl/_accessibility.py", line 17, in <module>
    from playwright._impl._connection import Channel
  File "/home/pedro/.local/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 35, in <module>
    from pyee import EventEmitter
  File "/home/pedro/.local/lib/python3.10/site-packages/pyee/__init__.py", line 73, in <module>
    from pyee._trio import TrioEventEmitter  # noqa
  File "/home/pedro/.local/lib/python3.10/site-packages/pyee/_trio.py", line 4, in <module>
    import trio
  File "/home/pedro/.local/lib/python3.10/site-packages/trio/__init__.py", line 18, in <module>
    from ._core import (
  File "/home/pedro/.local/lib/python3.10/site-packages/trio/_core/__init__.py", line 27, in <module>
    from ._run import (
  File "/home/pedro/.local/lib/python3.10/site-packages/trio/_core/_run.py", line 2452, in <module>
    from ._io_epoll import EpollIOManager as TheIOManager
  File "/home/pedro/.local/lib/python3.10/site-packages/trio/_core/_io_epoll.py", line 188, in <module>
    class EpollIOManager:
  File "/home/pedro/.local/lib/python3.10/site-packages/trio/_core/_io_epoll.py", line 189, in EpollIOManager
    _epoll = attr.ib(factory=select.epoll)
AttributeError: module 'select' has no attribute 'epoll'. Did you mean: 'poll'?

I'm missing something here?

willydouhard commented 1 year ago

Hello, someone had a similar issue and fixed it by setting a new env (https://discord.com/channels/1088038867602526210/1113461363197608047/1114256583317270600).

What python version os and terminal do you use?

sam-vish commented 1 year ago

Update the packages or try Virtual environment