daijro / camoufox

🦊 Anti-detect browser
https://camoufox.com
Mozilla Public License 2.0
639 stars 49 forks source link

[docs] Debian needs `libgtk-3-0`, `libx11-xcb1` & `libasound2` to run Camoufox #44

Closed tobwen closed 4 weeks ago

tobwen commented 1 month ago

Describe the bug:

When installing Camoufox on a fresh debian, fetching it, installing xfvb isn't enough. Debian also needs libgtk-3-0, libx11-xcb1 and libasound2: apt install --no-install-recommends ...

Screenshots:

camoufox fetch
browser-helper-file.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 4.5/1.0 kB      ?
header-network.json      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 142.8/142.8 kB  3.6 MB/s
headers-order.json       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 2,604/475 bytes ?
input-network.json       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 7.1/7.1 kB      4.6 MB/s
fingerprint-network.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 1.0/1.0 MB      11.9 MB/s
Fetching Camoufox binaries v130.0.1-beta.11...
Downloading package: https://github.com/daijro/camoufox/releases/download/v130.0.1-beta.11/camoufox-130.0.1-beta.11-lin.x86_64.zip
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 741M/741M [00:10<00:00, 69.3MiB/s]
Extracting Camoufox: /root/.cache/camoufox
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 717/717 [00:05<00:00, 138.46it/s]

Camoufox successfully installed.

venv/bin/python3 test.py
Downloading addon (UBO): 100%|█████████████████████████████████████████████████████████████████████████████████████████| 3.96M/3.96M [00:01<00:00, 2.94MiB/s]
Extracting addon (UBO): 100%|████████████████████████████████████████████████████████████████████████████████████████████| 620/620 [00:00<00:00, 8141.55it/s]
Downloading addon (BPC): 100%|███████████████████████████████████████████████████████████████████████████████████████████| 227k/227k [00:00<00:00, 1.31MiB/s]
Extracting addon (BPC): 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 40/40 [00:00<00:00, 8200.01it/s]
Traceback (most recent call last):
  File "/camoufox/test.py", line 3, in <module>
    with Camoufox(
  File "/camoufox/venv/lib/python3.11/site-packages/camoufox/sync_api.py", line 29, in __enter__
    self.browser = NewBrowser(self._playwright, **self.launch_options)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/camoufox/venv/lib/python3.11/site-packages/camoufox/sync_api.py", line 135, in NewBrowser
    return playwright.firefox.launch(**opt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/camoufox/venv/lib/python3.11/site-packages/playwright/sync_api/_generated.py", line 14157, in launch
    self._sync(
  File "/camoufox/venv/lib/python3.11/site-packages/playwright/_impl/_sync_base.py", line 115, in _sync
    return task.result()
           ^^^^^^^^^^^^^
  File "/camoufox/venv/lib/python3.11/site-packages/playwright/_impl/_browser_type.py", line 95, in launch
    Browser, from_channel(await self._channel.send("launch", params))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/camoufox/venv/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/camoufox/venv/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 514, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TargetClosedError: BrowserType.launch: Target page, context or browser has been closed
Browser logs:

<launching> /root/.cache/camoufox/camoufox-bin -no-remote -wait-for-browser -foreground -profile /tmp/playwright_firefoxdev_profile-XXXXXX7HDgJc -juggler-pipe -start-debugger-server 36041 -silent
<launched> pid=4016
[pid=4016][err] XPCOMGlueLoad error for file /root/.cache/camoufox/libmozgtk.so:
[pid=4016][err] libgtk-3.so.0: cannot open shared object file: No such file or directory
[pid=4016][err] Couldn't load XPCOM.
[pid=4016] <process did exit: exitCode=255, signal=null>
[pid=4016] starting temporary directories cleanup
Call log:
<launching> /root/.cache/camoufox/camoufox-bin -no-remote -wait-for-browser -foreground -profile /tmp/playwright_firefoxdev_profile-XXXXXX7HDgJc -juggler-pipe -start-debugger-server 36041 -silent
  - <launched> pid=4016
  - [pid=4016][err] XPCOMGlueLoad error for file /root/.cache/camoufox/libmozgtk.so:
  - [pid=4016][err] libgtk-3.so.0: cannot open shared object file: No such file or directory
  - [pid=4016][err] Couldn't load XPCOM.
  - [pid=4016] <process did exit: exitCode=255, signal=null>
  - [pid=4016] starting temporary directories cleanup

To Reproduce:

test.py

from camoufox.sync_api import Camoufox

with Camoufox(
    headless="virtual"
) as browser:
    page = browser.new_page()
    page.goto("https://example.com")

then run this:

camoufox fetch
python3 test.py

Version:

Pip package:    v0.2.15
Camoufox:       v130.0.1-beta.11 (Up to date!)
daijro commented 4 weeks ago

Just added it:

https://camoufox.com/python/installation

Thanks!