Skip to content

OSError: [Errno 86] Bad CPU type in executable - downloading uc_driver on MacOS #2558

Closed
@Dylgod

Description

@Dylgod

Device: Mac Mini
MacOS: Sonoma 14.3.1 (23D60)
Chrome: Version 122.0.6261.94 (Official Build) (arm64)

When running this code:

from seleniumbase import Driver
from selenium.webdriver.common.by import By

web = Driver(browser='chrome', uc=True)

web.get("https://www.youtube.com")
web.sleep(5)
print(web.find_element(By.XPATH, '/html/body').text)
web.quit()

I get back

Warning: uc_driver update needed. Getting it now:

*** chromedriver to download = 122.0.6261.94 (Latest Stable) 

Downloading chromedriver-mac-x64.zip from:
https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.94/mac-x64/chromedriver-mac-x64.zip ...
Download Complete!

Extracting ['chromedriver'] from chromedriver-mac-x64.zip ...
Unzip Complete!

The file [uc_driver] was saved to:
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/seleniumbase/drivers/uc_driver

Making [uc_driver 122.0.6261.94] executable ...
[uc_driver 122.0.6261.94] is now ready for use!

Traceback (most recent call last):
  File "/Users/shy/PycharmProjects/pythonProject/shy_drivers/mac_shytest.py", line 4, in <module>
    web = Driver(browser='chrome', uc=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/seleniumbase/plugins/driver_manager.py", line 488, in Driver
    driver = browser_launcher.get_driver(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/seleniumbase/core/browser_launcher.py", line 1612, in get_driver
    return get_local_driver(
           ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/seleniumbase/core/browser_launcher.py", line 3510, in get_local_driver
    driver = undetected.Chrome(
             ^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/seleniumbase/undetected/__init__.py", line 312, in __init__
    super().__init__(options=options, service=service_)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
    self.service.start()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self._start_process(self._path)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 208, in _start_process
    self.process = subprocess.Popen(
                   ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 86] Bad CPU type in executable: '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/seleniumbase/drivers/uc_driver'

I am new to to Mac so it is possible i have done something wrong.

Activity

mdmintz

mdmintz commented on Mar 1, 2024

@mdmintz
Member

Related to ultrafunkamsterdam/undetected-chromedriver#1020 (comment)

You need Rosetta 2 on your Mac:

softwareupdate --install-rosetta
Dylgod

Dylgod commented on Mar 2, 2024

@Dylgod
Author

Thank you! Also wondering if i were to create an .app and distribute it would i need to bundle Rosetta 2 with it?

mdmintz

mdmintz commented on Mar 2, 2024

@mdmintz
Member

Do you mean with Pyinstaller? Not sure… it probably depends on the system.

Dylgod

Dylgod commented on Mar 2, 2024

@Dylgod
Author

Yeah I currently use Pyinstaller to package a windows app and it works great for windows. I hope to do the same on Mac.

Is there an Apple Silicon build of UC? Or does the auto-fetch for uc_driver only have a build for Intel?

If there's only an Intel build then is there a way to get an Apple Silicon build?

(Apologies if my understanding of the situation isn't quite right, this is day 1 of entering the Mac universe for me)

mdmintz

mdmintz commented on Mar 2, 2024

@mdmintz
Member

The chromedriver-to-uc_driver conversion script on a Mac only works with the Intel chromedriver. But that's not an issue if Rosetta 2 is installed.

mdmintz

mdmintz commented on Jan 30, 2025

@mdmintz
Member

Fix "Bad CPU type" with Rosetta 2: https://apple.stackexchange.com/a/408379/607628

Image

softwareupdate --install-rosetta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP Modeworkaround existsYou can reach your destination if you do this...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mdmintz@Dylgod

        Issue actions

          OSError: [Errno 86] Bad CPU type in executable - downloading uc_driver on MacOS · Issue #2558 · seleniumbase/SeleniumBase