[Question]: Getting error `FileNotFoundError: [Errno 2] No such file or directory: '/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/driver/playwright-cli'`
See original GitHub issueYour question
I just installed playwright and tried running the example script as per the readme but I am getting an error:
my script:
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
for browser_type in [p.chromium, p.firefox, p.webkit]:
browser = await browser_type.launch()
page = await browser.new_page()
await page.goto('http://whatsmyuseragent.org/')
await page.screenshot(path=f'example-{browser_type.name}.png')
await browser.close()
asyncio.run(main())
>>> Traceback (most recent call last):
File "/Users/my_user/Documents/pwright/test1.py", line 18, in <module>
asyncio.run(main())
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/my_user/Documents/pwright/test1.py", line 9, in main
async with async_playwright() as p:
File "/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/main.py", line 110, in __aenter__
self._connection = await run_driver_async()
File "/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/main.py", line 56, in run_driver_async
proc = await asyncio.create_subprocess_exec(
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 1661, in subprocess_exec
transport = await self._make_subprocess_transport(
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
transp = _UnixSubprocessTransport(self, protocol, args, shell,
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/unix_events.py", line 789, in _start
self._proc = subprocess.Popen(
File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/my_usery/.pyenv/versions/3.9.1/lib/python3.9/subprocess.py", line 1819, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/driver/playwright-cli'
- My Python version 3.9.1
- Pyenv virtualenv for creating virtual environment
- macOS big sur [intel mac]
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
FileNotFoundError: [Errno 2] No such file or directory [duplicate]
The error is telling you that there is no file of that name in the working directory. Try using the exact, or absolute,...
Read more >Python FileNotFoundError: [Errno 2] No such file or directory ...
This error tells you that you are trying to access a file or folder that does not exist. To fix this error, check...
Read more >How to fix FileNotFoundError Errno 2 no such file or directory
The error FileNotFoundError Errno 2 no such file or directory occurs when Python cannot find the specified file in the current directory.
Read more >FileNotFoundError: [Errno 2] No such file or directory
The error "FileNotFoundError: [Errno 2] No such file or directory" is telling you that there is no file of that name in the...
Read more >Filenotfounderror errno 2 no such file or directory python error ...
How to solve filenotfounderror errno 2 no such file or directory in python is shown.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
--no-cache-dir
and uninstall etc. is I think not required. Onlypip install --upgrade pip
Awesome, TL;DR was that the PIP version which you were using did not support the package file naming which we use to distribute. After upgrading PIP it works as expected.
We can add
pip install --upgrade pip
in our intro: https://github.com/microsoft/playwright/blob/master/docs/src/intro-python.md(I would add it before we run the
pip install playwright
command.