質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
スクレイピング

スクレイピングとは、公開されているWebサイトからページ内の情報を抽出する技術です。

JupyterLab

JupyterLabは、Jupyter notebookの後継の対話型開発環境(IDE)です。データの可視化がインタラクティブで、プラグイン作成により新しいコンポーネントの追加および既存のコンポーネントも統合可能。サーバに閉じているため、データ分析に向いています。

Chrome

Google Chromeは携帯、テレビ、デスクトップなどの様々なプラットフォームで利用できるウェブブラウザです。Googleが開発したもので、Blink (レンダリングエンジン) とアプリケーションフレームワークを使用しています。

Webサーバー

Webサーバーとは、HTTPリクエストに応じて、クライアントに情報を提供するシステムです。

selenium

Selenium(セレニウム)は、ブラウザをプログラムで作動させるフレームワークです。この原理を使うことにより、ブラウザのユーザーテストなどを自動化にすることができます。

Q&A

解決済

1回答

1347閲覧

サーバー上のjupyter labでchrome driverが動作しない

atrook

総合スコア18

スクレイピング

スクレイピングとは、公開されているWebサイトからページ内の情報を抽出する技術です。

JupyterLab

JupyterLabは、Jupyter notebookの後継の対話型開発環境(IDE)です。データの可視化がインタラクティブで、プラグイン作成により新しいコンポーネントの追加および既存のコンポーネントも統合可能。サーバに閉じているため、データ分析に向いています。

Chrome

Google Chromeは携帯、テレビ、デスクトップなどの様々なプラットフォームで利用できるウェブブラウザです。Googleが開発したもので、Blink (レンダリングエンジン) とアプリケーションフレームワークを使用しています。

Webサーバー

Webサーバーとは、HTTPリクエストに応じて、クライアントに情報を提供するシステムです。

selenium

Selenium(セレニウム)は、ブラウザをプログラムで作動させるフレームワークです。この原理を使うことにより、ブラウザのユーザーテストなどを自動化にすることができます。

0グッド

0クリップ

投稿2021/08/15 07:13

前提・実現したいこと

会社のlinuxサーバー上のjupyter labにて、ローカルで書いていたseleniumを使ったスクレイピングのコードを実行したいのですが、chrome driverが使えなくて困っています。

linux64版のchrome driverの最新バージョン(ChromeDriver 93.0.4577.15)を公式サイトから直接インストールし、chromedriver_linux2という名前で作業ディレクトリに置いています。

該当のソースコード

python3

1from selenium import webdriver 2from selenium.webdriver.chrome.options import Options 3 4# オプション指定 5options = Options() 6options.add_argument('--disable-gpu'); 7options.add_argument('--disable-extensions'); 8options.add_argument('--proxy-server="direct://"'); 9options.add_argument('--proxy-bypass-list=*'); 10options.add_argument('--start-maximized'); 11options.add_argument('--headless'); 12 13driver = webdriver.Chrome(executable_path='/home/jovyan/chromedriver_linux2',options=options) 14driver.get("https://www.google.com/")

発生している問題・エラーメッセージ

--------------------------------------------------------------------------- WebDriverException Traceback (most recent call last) /tmp/ipykernel_145/3439268704.py in <module> 11 options.add_argument('--headless'); 12 ---> 13 driver = webdriver.Chrome(executable_path='/home/jovyan/chromedriver_linux2',options=options) 14 driver.get("https://www.google.com/") ~/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive) 74 75 try: ---> 76 RemoteWebDriver.__init__( 77 self, 78 command_executor=ChromeRemoteConnection( ~/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options) 155 warnings.warn("Please use FirefoxOptions to set browser profile", 156 DeprecationWarning, stacklevel=2) --> 157 self.start_session(capabilities, browser_profile) 158 self._switch_to = SwitchTo(self) 159 self._mobile = Mobile(self) ~/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities, browser_profile) 250 parameters = {"capabilities": w3c_caps, 251 "desiredCapabilities": capabilities} --> 252 response = self.execute(Command.NEW_SESSION, parameters) 253 if 'sessionId' not in response: 254 response = response['value'] ~/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params) 319 response = self.command_executor.execute(driver_command, params) 320 if response: --> 321 self.error_handler.check_response(response) 322 response['value'] = self._unwrap_value( 323 response.get('value', None)) ~/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response) 240 alert_text = value['alert'].get('text') 241 raise exception_class(message, screen, stacktrace, alert_text) --> 242 raise exception_class(message, screen, stacktrace) 243 244 def _value_or_default(self, obj, key, default): WebDriverException: Message: unknown error: cannot find Chrome binary

試したこと

  • chmodコマンドで権限付与しました
  • chrome driverの他のバージョンを試しました
  • pip install chromedriver-binaryでのダウンロードを試しましたが、うまくいきませんでした

補足情報

今までローカルもしくはgoogle colabでしか作業したことがなく、知識不足により的外れな質問になっているかもしれませんが、ご助言いただけると幸いです。

また、実現したいのは会社のサーバー上でのスクレイピング処理なので、他のアプローチなどあれまそちらもお教えいただけると幸いです。

よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

jbpb0

2021/08/15 08:17 編集

> cannot find Chrome binary そのサーバーにChrome入れてます? (ChromeDriverじゃなくて、WebブラウザのChrome)
atrook

2021/08/15 08:27

なるほど! 入れてないと思います。 確かにchrome driverはchromeをプログラムで操作するためのドライバなので元々のchromeがなければ動作するわけがないですよね。 管理者権限がないとサーバーにchromeをダウンロードすることはできないのでしょうか? 作業ディレクトリにchrome driverを追加したように、chrome本体をダウンロードすることって可能なのでしょうか? サーバーに関する知識が無さすぎてよく理解していません、、申し訳ないです。。
jbpb0

2021/08/15 08:47 編集

> 管理者権限がないとサーバーにchromeをダウンロードすることはできないのでしょうか? 管理してる人に聞いてください 下記の「質問への追記・修正の依頼」が参考になるかも https://teratail.com/questions/349068
guest

回答1

0

ベストアンサー

cannot find Chrome binary

そのサーバーにChromeをインストールする必要があります
(ChromeDriverじゃなくて、WebブラウザのChrome)

投稿2021/08/15 11:14

jbpb0

総合スコア7651

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問