camoufox icon indicating copy to clipboard operation
camoufox copied to clipboard

Installation Issue

Open iamrocan opened this issue 7 months ago • 5 comments

i've installed camoufox as in website says, but i got this issue with my first code

playwright._impl._errors.Error: BrowserType.launch: Failed to launch firefox because executable doesn't exist at C:\Users\Admin\AppData\Local\camoufox\camoufox\Cache\camoufox.exe

so there is some video to how to install it?

i'm using windows 11

camoufox version Pip package: v0.4.11 Camoufox: v135.0.1-beta.24 (Up to date!)

iamrocan avatar Apr 25 '25 18:04 iamrocan

You have to run camoufox fetch.

Next time RTFM https://camoufox.com/python/installation/

lu4p avatar Apr 26 '25 10:04 lu4p

This is actually an issue... - For whatever reason on Windows 11, it acts like it's downloading and extracting to the correct path ...\AppData\Local\camoufox\camoufox\Cache, but the path doesn't exist past Local after "successful install". I thought maybe it was a third-party library issue at first, but can't even run camoufox test:

camoufox fetch 
Fetching Camoufox binaries v135.0.1-beta.24...
Downloading package: https://github.com/daijro/camoufox/releases/download/v135.0.1-beta.24/camoufox-135.0.1-beta.24-win.x86_64.zip
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 530M/530M [00:07<00:00, 72.4MiB/s]
Extracting Camoufox: C:\Users\***\AppData\Local\camoufox\camoufox\Cache
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:03<00:00, 128.71it/s] 

Camoufox successfully installed.
Downloading addon (UBO): 100%
Extracting addon (UBO): 100%
(.venv) PS D:\Code\***> camoufox test  
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\Code\***\.venv\Scripts\camoufox.exe\__main__.py", line 7, in <module>
    sys.exit(cli())
             ~~~^^
  File "d:\Code\***\.venv\Lib\site-packages\click\core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "d:\Code\***\.venv\Lib\site-packages\click\core.py", line 1363, in main
    rv = self.invoke(ctx)
  File "d:\Code\***\.venv\Lib\site-packages\click\core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "d:\Code\***\.venv\Lib\site-packages\click\core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Code\***\.venv\Lib\site-packages\click\core.py", line 794, in invoke
    return callback(*args, **kwargs)
  File "d:\Code\***\.venv\Lib\site-packages\camoufox\__main__.py", line 117, in test
    with Camoufox(headless=False, env=environ, config={'showcursor': False}) as browser:
         ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Code\***\.venv\Lib\site-packages\camoufox\sync_api.py", line 29, in __enter__
    self.browser = NewBrowser(self._playwright, **self.launch_options)
                   ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Code\***\.venv\Lib\site-packages\camoufox\sync_api.py", line 94, in NewBrowser
    browser = playwright.firefox.launch(**from_options)
  File "d:\Code\***\.venv\Lib\site-packages\playwright\sync_api\_generated.py", line 14494, in launch
    self._sync(
    ~~~~~~~~~~^
        self._impl_obj.launch(
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<17 lines>...
        )
        ^
    )
    ^
  File "d:\Code\***\.venv\Lib\site-packages\playwright\_impl\_sync_base.py", line 115, in _sync
    return task.result()
           ~~~~~~~~~~~^^
  File "d:\Code\***\.venv\Lib\site-packages\playwright\_impl\_browser_type.py", line 97, in launch
    Browser, from_channel(await self._channel.send("launch", params))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Code\***\.venv\Lib\site-packages\playwright\_impl\_connection.py", line 61, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "d:\Code\***\.venv\Lib\site-packages\playwright\_impl\_connection.py", line 528, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: BrowserType.launch: Failed to launch firefox because executable doesn't exist at C:\Users\***\AppData\Local\camoufox\camoufox\Cache\camoufox.exe

When I run camoufox path, it thinks the install location is valid :

camoufox path
C:\Users\***\AppData\Local\camoufox\camoufox\Cache
Image

I played around with it for a bit:

  • Switching to Admin prompt did nothing
  • Forcing folder creation in AppData did nothing
  • Changing to the C: drive and then running did nothing
  • I did change the INSTALL_DIR to my current working dir and the download was successful. So I don't think it has anything to do with the download process.

Not exactly sure what Windows is doing under the hood, but it seems to be faking out the mkdir and extraction calls. Let me know how I can help debug further.

zacka026 avatar May 15 '25 11:05 zacka026

I've determined that it's somehow sandboxing C:\Users\***\AppData\Local\ to C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache

Not entirely sure why or how to give camoufox the new dest path.

UPDATE: For anyone stuck in this similar situation, the current workaround is to uninstall python from the Microsoft Store and install directly from python's website. Hope this helps!

zacka026 avatar May 17 '25 17:05 zacka026

I've determined that it's somehow sandboxing C:\Users\***\AppData\Local\ to C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache

Not entirely sure why or how to give camoufox the new dest path.

UPDATE: For anyone stuck in this similar situation, the current workaround is to uninstall python from the Microsoft Store and install directly from python's website. Hope this helps!

Thanks for the info about the path. I found another workaround, even with Python from MS Store. If you follow the path: C:\Users*\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache, then go to Local, you will see the folder "camoufox". Copy the folder and paste it into this directory: C:\Users*\AppData\Local. This way the browser will start. The only inconvenience is if there is an update - you'll have to manually update your pasted folder as well. But it works at least

Demsli avatar Jun 06 '25 15:06 Demsli

Here is a complete workaround and fix. Uninstall all versions of Python and install Python 314. Start > Edit Environment Variables For Your Account > Environment Variables... > Click on Path under User Variables for 'YourDrive/PC' > New > Type the following (Ensure your drive name/PC name replaces the placeholder; C:\Users\Placeholder\AppData\Roaming\Python\Python314\Scripts > Press OK to all options > Start a new CMD/Powershell > Type; camoufox fetch

lukesadventuresinCS avatar Oct 23 '25 05:10 lukesadventuresinCS