プロキシを通したライブラリ(PyAutoGUI)のインストール
解決済
回答 1
投稿
- 評価
- クリップ 0
- VIEW 1,746
前提・実現したいこと
Pythonを勉強し始めて1か月程度の初心者です。他にプログラミング経験はありません。
PyAutoGUIライブラリをコマンドプロンプトにてインストールしようとしているのですが、うまくいきません。
会社でプロキシがあるので、プロキシがある状態でのインストール方法を調べて試しましたができず、
オフラインでもインストールしてみましたができませんでした。
エラー等を見る限りPyAutoGUIをインストールする場合はオンラインが必要な感じがします。
どうしたらインストールできますか?
プロキシのセットや書き方が何か間違っているのでしょうか?
ご教示よろしくお願いいたします。
発生している問題・エラーメッセージ
⓵
C:\Users\******>py -m pip install pyautogui --proxy http://[ID]:[PASS]@proxy2.*********:8080
Collecting pyautogui
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))': /simple/pyautogui/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))': /simple/pyautogui/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))': /simple/pyautogui/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))': /simple/pyautogui/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))': /simple/pyautogui/
Could not fetch URL https://pypi.org/simple/pyautogui/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pyautogui/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))) - skipping
ERROR: Could not find a version that satisfies the requirement pyautogui (from versions: none)
ERROR: No matching distribution found for pyautogui
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))) - skippingSSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))) - skipping
⓶
C:\Users\******>set HTTP_PROXY=http://[ID]:[PASS]@proxy2.*********:8080
C:\Users\******>py -m pip install pyautogui
Collecting pyautogui
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x042E98B0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x042E99D0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x042E9B80>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x042E9328>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0432A040>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui/
ERROR: Could not find a version that satisfies the requirement pyautogui (from versions: none)
ERROR: No matching distribution found for pyautogui
⓷
C:\Users\******>cd Documents
C:\Users\******\Documents>py -m pip install --no-index --find-links=pyautogui_src pyautogui
Looking in links: pyautogui_src
Collecting pyautogui
Collecting pymsgbox (from pyautogui)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\******\AppData\Local\Programs\Python\Python38-32\python.exe' 'C:\Users\******\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\******\AppData\Local\Temp\pip-build-env-sxmby76v\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links pyautogui_src -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (4 lines):
Looking in links: pyautogui_src
Collecting setuptools>=40.8.0
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\******\AppData\Local\Programs\Python\Python38-32\python.exe' 'C:\Users\******\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\******\AppData\Local\Temp\pip-build-env-sxmby76v\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links pyautogui_src -- 'setuptools>=40.8.0' wheel Check the logs for full command output.
⓸
C:\Users\******\Documents>py -m pip install pyautogui_src
Collecting pyautogui_src
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04429838>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui-src/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04429460>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui-src/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04429B98>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui-src/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04429628>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui-src/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04429AA8>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/pyautogui-src/
ERROR: Could not find a version that satisfies the requirement pyautogui_src (from versions: none)
ERROR: No matching distribution found for pyautogui_src
⓹
C:\Users\******>cd Documents\pyautogui_src
C:\Users\******\Documents\pyautogui_src>py -m pip install PyAutoGUI-0.9.50.tar.gz
Processing c:\users\******\documents\pyautogui_src\pyautogui-0.9.50.tar.gz
Collecting pymsgbox (from PyAutoGUI==0.9.50)
WARNING: --------字数制限の為短縮 ⓸と同一エラー繰り返し--------
ERROR: Could not find a version that satisfies the requirement pymsgbox (from PyAutoGUI==0.9.50) (from versions: none)
ERROR: No matching distribution found for pymsgbox (from PyAutoGUI==0.9.50)
該当のソースコード
⓵
py -m pip install pyautogui --proxy http://[ID]:[PASS]@proxy2.*********:8080
⓶
set HTTP_PROXY=http://[ID]:[PASS]@proxy2.*********:8080
py -m pip install pyautogui
⓷
C:\Users\******>cd Documents
C:\Users\******\Documents>py -m pip install --no-index --find-links=pyautogui_src pyautogui
⓸
C:\Users\******\Documents>py -m pip install pyautogui_src
⓹
C:\Users\******>cd Documents\pyautogui_src
C:\Users\******\Documents\pyautogui_src>py -m pip install PyAutoGUI-0.9.50.tar.gz
試したこと
以上のようにいろいろ試していますがインストールできておりません。
プロキシはPACを開いて一番下の行にあった複数(proxy2,3,4)を試しましたができませんでした。
⓷~⓹のように、オフラインでインストールしてもエラーが出ます。
パッケージの中を1つ1つオフラインでインストールした場合(⓹)、
PyAutoGUIとPyMsgBoxだけインストールできませんでした。
補足情報(FW/ツールのバージョンなど)
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Package Version
----------- -------
et-xmlfile 1.0.1
jdcal 1.4.1
MouseInfo 0.1.3
openpyxl 3.0.3
Pillow 7.1.2
pip 19.2.3
PyGetWindow 0.0.8
pyperclip 1.8.0
PyRect 0.1.4
PyScreeze 0.1.26
PyTweening 1.0.3
selenium 3.141.0
setuptools 41.2.0
urllib3 1.25.9
今までインストールした物はとりあえずオフラインで入れています。
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
checkベストアンサー
+1
原因
(1)のログから抜粋。
Could not fetch URL https://pypi.org/simple/pyautogui/:
There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443):
Max retries exceeded with url: /simple/pyautogui/
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)'))) - skipping
self signed certificate
(自己署名証明書)により証明書の認証に失敗している、ということです。
おそらく自PC~プロキシ間の通信にプロキシ自身が発行した自己署名証明書を使用しているのでしょう。
対策
1つは、pip時に--trusted-host
オプションをセットすること。指定のホストへの通信に対し、証明書のエラーを無視してくれます。
今回はpypi.org
に対しての通信なので、py -m pip install pyautogui --trusted-host pypi.org --proxy http://[ID]:[PASS]@proxy2.*********:8080
のように指定することで証明書のエラーを回避できます(できないかもしれません)
もう一つの対策は、質問者が(5)で行った通りオフラインでインストールすることですが、依存関係にあるパッケージがインストールされていないと失敗します。
本件の場合はpymsgbox
を先にインストールする必要があるので、PyAutoGUIのアーカイブを取得したようにpymsgboxのアーカイブを別途取得し、同じようにインストールしてやれば良いでしょう。
さらに依存関係がある場合も同様に順番に解決していけば大丈夫だと思います。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.10%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
質問への追記・修正、ベストアンサー選択の依頼
hentaiman
2020/06/17 23:55
会社の人に聞いた方が良いよ
ちょっと出来る中級程度の人じゃなくてちゃんと上位の技術レベル持ってる人
meg_
2020/06/18 07:10 編集
私の場合は環境変数をセットすればプロキシ対応出来ました。httpsについても設定してみてください。
YuYuto
2020/06/18 13:56
無事解決しました。ありがとうございました。