locust-plugins: AttributeError: module 'select' has no attribute 'epoll' (playwright)

Hi, I ran into issues with this and would really appreciate if someone knows what to do with it, as I’m complete rookie here.

So I’m running the test in dev-container (Ubuntu-22.04), python 3.10., but it wasn’t better in non-containerized environment. I tried both variants with either using the script or “manual” code. Neither work anywhere, unfortunately. I got very lovely error when running my locustfile. I got the same error when the example file is run.

Traceback (most recent call last): File "/home/vscode/.local/bin/locust", line 8, in <module> sys.exit(main()) File "/home/vscode/.local/lib/python3.10/site-packages/locust/main.py", line 68, in main docstring, _user_classes, shape_class = load_locustfile(_locustfile) File "/home/vscode/.local/lib/python3.10/site-packages/locust/util/load_locustfile.py", line 58, in load_locustfile imported = source.load_module() File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper File "<frozen importlib._bootstrap_external>", line 1063, in load_module File "<frozen importlib._bootstrap_external>", line 888, in load_module File "<frozen importlib._bootstrap>", line 290, in _load_module_shim File "<frozen importlib._bootstrap>", line 719, in _load File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/workspace/test/automation/load_testing/locustfile3.py", line 4, in <module> from locust_plugins.users.playwright import PlaywrightScriptUser, pw, event, run_single_user, PageWithRetry File "/home/vscode/.local/lib/python3.10/site-packages/locust_plugins/users/playwright.py", line 2, in <module> from playwright.async_api import async_playwright, Playwright, Browser, Page, BrowserContext File "/home/vscode/.local/lib/python3.10/site-packages/playwright/async_api/__init__.py", line 25, in <module> import playwright.async_api._generated File "/home/vscode/.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/vscode/.local/lib/python3.10/site-packages/playwright/_impl/_accessibility.py", line 17, in <module> from playwright._impl._connection import Channel File "/home/vscode/.local/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 24, in <module> from pyee import EventEmitter File "/home/vscode/.local/lib/python3.10/site-packages/pyee/__init__.py", line 120, in <module> from pyee.trio import TrioEventEmitter as _TrioEventEmitter # noqa File "/home/vscode/.local/lib/python3.10/site-packages/pyee/trio.py", line 7, in <module> import trio File "/home/vscode/.local/lib/python3.10/site-packages/trio/__init__.py", line 18, in <module> from ._core import ( File "/home/vscode/.local/lib/python3.10/site-packages/trio/_core/__init__.py", line 27, in <module> from ._run import ( File "/home/vscode/.local/lib/python3.10/site-packages/trio/_core/_run.py", line 2452, in <module> from ._io_epoll import EpollIOManager as TheIOManager File "/home/vscode/.local/lib/python3.10/site-packages/trio/_core/_io_epoll.py", line 188, in <module> class EpollIOManager: File "/home/vscode/.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'?

Is there, please, any easy fix. I really have issues testing that page with simple requests. Thanks in forward.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 37 (7 by maintainers)

Most upvoted comments

I had a similar issue, I was running locust in Manjaro and it showed a very similar error. I found the solution in this issue here #74. Setting the env var LOCUST_PLAYWRIGHT=1 while running locust seems to solve the problem for me.

This command works for me:

LOCUST_PLAYWRIGHT=1 locust

Looks like httpcore imports trio, just like Playwright does and needs the same workaround (early import of trio). I could make it so that locust automatically imports trio if it is available (instead of relying on LOCUST_PLAYWRIGHT env var). I’m a bit hesitant to do that because it will implicitly change behaviour based on a package being installed, which is a little weird. But I guess that could work…

Delete or rename both files?

… and if that doesnt help, maybe reboot your computer 😃

I hope this will help. Yesterday, I looked through my package list in the project to see which packages had new releases in the last weeks. When I explicitly set httpcore==0.17.2 in my requirements.txt file everything works fine. When I bump to httpcode==0.17.3 the error occurs again and I need to set LOCUST_PLAYWRIGHT=1 in order for things to work.

I had a similar issue, I was running locust in Manjaro and it showed a very similar error. I found the solution in this issue here #74. Setting the env var LOCUST_PLAYWRIGHT=1 while running locust seems to solve the problem for me.

This command works for me:

LOCUST_PLAYWRIGHT=1 locust

Thanks a lot! It works!

Added LOCUST_PLAYWRIGHT: 1 to value.yaml for kuber

Sorry, I dont know what is causing this. It has worked for me on OSX and Ubuntu (in fact the automated builds here on GH run successfully on Ubuntu 20.04.5). Maybe check playwright or trio packages if someone has had similar issues there.