← Back to Discord Forum

Installation on Python Help


This thread is trying to answer question "How can I resolve the installation issues with Python and its related packages, specifically 'greenlet' and 'playwright'?"

49 replies

Make sure u run "echo %PATH%" outside of your virtual environment. so just open up another terminal or something..

Did you install python to another directory than default maybe?

echo is now comeing back right: \Programs\Python\Python311\Scripts\

greenlet still seems to be an issue

would u like to join any of the voice channels in this discord so i can help u out there instead of typing?

i wish, but I'm already multi tasking by being in a work meeting at the same time as this troubleshooting nightmare

I see

As this is more of a python problem, and not so much a playwright problem. i'd suggest that you maybe seek help from the official python server. There might be someone that knows how to fix this easily for you, and I think you will get help much faster there

thanks for trying

No worries. let me know when the problem is fixed and how you solved it! 🙂

I think Python may be leaving me out to dry, after an hour of no response, their bot locked my post

Would you be against perhaps reinstalling python?

not that i think it's nessesary, but just to start fresh


  1. Uniinstall python completely from the system.
  2. Install python 3.11 (add python to PATH button checked)
  3. RUN py.exe -m pip install virtualenv
  4. change directory into your project
  5. RUN py.exe -m virtualenv venv
  6. RUN venv\Scripts\activate
  7. py.exe -m pip install pytest playwright

Then to make sure pytest is actually installed correctly.

  1. py.exe -m pytest --help

at this point, I'm willing to try anything twice

alright, pytest is now loaded propperly! I can actually do the Playwright stuff. thank you so much


no worries

can you by chance explain why "pip install pytest-playwright" is needed per the Playwright install guide? Everything goes south for me the second I try to run that

What happens when you install it?

basically the start of this post

though since I know nthe greenlet issue it jumps to "ImportError: DLL load failed while importing _greenlet" from pytest

right now all I know is running pytest right now, it is really unhappy platform win32 -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 rootdir: C:\Users\bdixon\AppData\Local\Programs\Python\Python311 collected 38208 items / 44 errors / 39 skipped

looking through the logs, looks like greenlet IS still a problem

ImportError: DLL load failed while importing _greenlet: The specified module could not be found.

doesn't seem to have changed any output for me yet. time to see if a magic reboot helps

Do you even need pytest-playwright?

well, it cleared up some stuff __________________________________________ ERROR collecting test_my_application.py ___________________________________________ ImportError while importing test module 'C:\Users\bdixon\AppData\Local\Microsoft\WindowsApps\Python\test_my_application.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ......\Programs\Python\Python311\Lib\importlib_init_.py:126: in import_module return _bootstrap.gcd_import(name[level:], package, level) test_my_application.py:2: in <module> from playwright.sync_api import Page, expect ..........\venv\Lib\site-packages\playwright\sync_api_init.py:25: in <module> import playwright.sync_api._generated ..........\venv\Lib\site-packages\playwright\sync_api_generated.py:25: in <module> from playwright._impl._accessibility import Accessibility as AccessibilityImpl ..........\venv\Lib\site-packages\playwright_impl_accessibility.py:17: in <module> from playwright._impl.connection import Channel ..........\venv\Lib\site-packages\playwright_impl_connection.py:34: in <module> from greenlet import greenlet ..........\venv\Lib\site-packages\greenlet_init.py:29: in <module> from ._greenlet import _C_API # pylint:disable=no-name-in-module E ImportError: DLL load failed while importing _greenlet: The specified module could not be found.

are you using it?

I'm not using pytets-playwright right now since it just makes me have to uninstall python

If this hinders your development and ur not even using any of the fixtures provided, then i'd say skip that dependency for now.

So use this to build the fixtures you want instead of using pre-defined fixtures from pytest-playwright


i keep hitting this greenlet issue and have no idea what's blocking me

pip uninstall pytest-playwright and continue developing without it

that's the problem, I don't have pytest-playwright installed. now the greenlet issue comes from running pytest, not trying to run pytest (if that makes sense)

(the greenlet issue comes from installing playwright which is a dependency of pytest-playwright)

ok, so if I install pytest-playwright, now to I get around the different greenlet issue?

ok, the good news is, I don't get the greenlet issue trying to run pytest after installing pytest-playwright any more. The bad news is, I still get the greenlet issue when running pytest


I think I broke it again

How I got to my level of brokeness

  1. Install Python w/ option to "Add Python to PATH"
  2. Change directory in Command Line to Project Directory
  3. "pip install msvc-runtime"
  4. "py.exe -m virtualenv venv"
  5. "venv\Scripts\activate"
  6. "pip install --upgrade pip"
  7. "py.exe -m pip install pytest playwright pytest-playwright"
  8. "pip install --force-reinstall greenlet==2.0.1"
  9. "playwright install"
  10. create the Playwright "Test_My_Application" test script
  11. "pytest"

pip freeze > remove.txt pip uninstall -r remove.txt

pip install pytest playwright

Do you really need pytest-playwright.

are you using any of the fixtures provided by pytest-playwright?

right now, I am just trying to run the Playwright example to confirm I have everything setup right. I am a long way before starting a real project

sadly that didn't change anything

Thanks for letting us know! I wrote a comment in the GitHub issue about it: https://github.com/microsoft/playwright-python/issues/1720#issuecomment-1574332805

Hi, I am new here I am on macOS Ventura, latest 3.11 Python, pip, pytest and Pycharm.

Followed standard installation methods, playwright 1.35 is visible with the drivers, but before I try to run the first helloworld test , I am getting error: from playwright.sync_api import Page, expect - here for playwright getting this: "Package containing module 'playwright' is not listed in the project requirements"

I have already re-run pip install -r requirements.txt, but does not add playwright to the requirements. What am I missing?

Solution was: I added playwright manually to the requirements.txt

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.