Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chromium distribution 'chrome' is not found #377

Open
keyiis opened this issue Dec 26, 2024 · 1 comment
Open

Chromium distribution 'chrome' is not found #377

keyiis opened this issue Dec 26, 2024 · 1 comment
Assignees

Comments

@keyiis
Copy link

keyiis commented Dec 26, 2024

My Environment:
OS: Windows 11
Python: 3.13.0
I have successfully run the following commands:

pip install crawl4ai
crawl4ai-setup # Setup the browser

Playwright was automatically installed in the directory D:\ProgramData\PLAYWRIGHT_BROWSERS, and I have also set the system environment variable PLAYWRIGHT_BROWSERS_PATH. However, when I run the sample code, I receive the following error:

playwright._impl._errors.Error: BrowserType.launch: Chromium distribution 'chrome' is not found at C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe
Run "playwright install chrome"

The official sample code I ran is as follows:

import asyncio
from crawl4ai import AsyncWebCrawler

async def main():
    # Create an instance of AsyncWebCrawler
    async with AsyncWebCrawler(verbose=True) as crawler:
        # Run the crawler on a URL
        result = await crawler.arun(url="https://www.bing.com")

        # Print the extracted content
        print(result.markdown)

# Run the async main function
asyncio.run(main())
@unclecode
Copy link
Owner

@keyiis I am a Mac user, and I will try your situation on a Windows machine. In the meantime, try the following steps and let me know how it goes.

1/ First, run the Playwright install command to install the required browser:

playwright install chromium

2/ Then modify your code to explicitly use Playwright's bundled Chromium instead of system Chrome:

import asyncio
from crawl4ai import AsyncWebCrawler
from crawl4ai.async_configs import BrowserConfig

async def main():
    # Create browser config to use bundled Chromium
    browser_config = BrowserConfig(
        browser_type="chromium",  # Use Playwright's bundled Chromium
        chrome_channel=None  # Don't try to use system Chrome
    )
    
    # Create crawler instance with the config
    async with AsyncWebCrawler(browser_config=browser_config, verbose=True) as crawler:
        # Run the crawler on a URL
        result = await crawler.arun(url="https://www.bing.com")
        
        # Print the extracted content
        print(result.markdown)

# Run the async main function
asyncio.run(main())

Alternative Solution: If you prefer to use your system's Chrome browser, you can install Chrome and make sure it's in the default installation path. However, I recommend using the bundled Chromium approach above as it's more reliable across different environments.

@unclecode unclecode self-assigned this Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants