Google Colaboratory上でSeleniumを動かしたいので、
- Google Chromeの最新版
- ChromeDriverの最新版
をそれぞれインストールしたいです。
しかし、実行してもエラーが出現します。
前提条件
- 開発環境はGoogle Colaboratory
- Seleniumでスクレイピングをしたい。
期待値
- Google Chromeの最新版とChromeDriverの最新版のインストールを成功させる。
- 上記二つのバージョンを一致させる。
再現手順
インストール時のコマンド
%%shell sudo apt -y update && sudo apt -y upgrade sudo apt install -y wget curl unzip # Google Chromeの依存関係をインストール sudo apt install libu2f-udev libvulkan1 # ChromeをDL&インストール wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome-stable_current_amd64.deb # ChromeDriverをDL&インストール wget -N https://chromedriver.storage.googleapis.com/99.0.4844.84/chromedriver_linux64.zipp -P /tmp/ unzip -o /tmp/chromedriver_linux64.zip -d /tmp/ chmod +x /tmp/chromedriver mv /tmp/chromedriver /usr/local/bin/chromedriver
実行結果
前略 E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). Reading package lists... Done Building dependency tree... Done Reading state information... Done wget is already the newest version (1.21.2-2ubuntu1). curl is already the newest version (7.81.0-1ubuntu1.13). unzip is already the newest version (6.0-26ubuntu3.1). You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: google-chrome-stable : Depends: libu2f-udev but it is not going to be installed Depends: libvulkan1 but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: libu2f-udev : Depends: udev (>= 244) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). --2023-09-24 13:29:01-- https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb Resolving dl.google.com (dl.google.com)... 142.250.99.136, 142.250.99.93, 142.250.99.190, ... Connecting to dl.google.com (dl.google.com)|142.250.99.136|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 103481376 (99M) [application/x-debian-package] Saving to: ‘google-chrome-stable_current_amd64.deb.2’ 中略 dpkg: dependency problems prevent configuration of google-chrome-stable: google-chrome-stable depends on libu2f-udev; however: Package libu2f-udev is not installed. google-chrome-stable depends on libvulkan1; however: Package libvulkan1 is not installed. dpkg: error processing package google-chrome-stable (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.10.2-1) ... Errors were encountered while processing: google-chrome-stable --2023-09-24 13:29:15-- https://chromedriver.storage.googleapis.com/99.0.4844.84/chromedriver_linux64.zipp Resolving chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)... 74.125.135.207, 74.125.195.207, 172.253.117.207, ... Connecting to chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)|74.125.135.207|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2023-09-24 13:29:15 ERROR 404: Not Found. 中略 unzip: cannot find or open /tmp/chromedriver_linux64.zip, /tmp/chromedriver_linux64.zip.zip or /tmp/chromedriver_linux64.zip.ZIP. chmod: cannot access '/tmp/chromedriver': No such file or directory mv: cannot stat '/tmp/chromedriver': No such file or directory 中略 CalledProcessError Traceback (most recent call last) 中略 CalledProcessError: Command ' 実行したコマンド ' returned non-zero exit status 1.
マルチポスト
StackOverflowにも同じ質問を投稿してます。

あなたの回答
tips
プレビュー