LoginSignup
3
2

More than 3 years have passed since last update.

【Python】pyautogui(PyMsgBox)インストールエラーに対する暫定対策

Posted at

概要

昨日(2020/05/24)、pipで外部ライブラリのpyautoguiをインストールしようとしたら、エラーが出てインストールができなかった。半月ほど前は同じPCで問題なくインストールできていたので、おかしいな、と思いアレコレ試してみた。根本的な原因はまだ分かっていないが、ひとまず暫定的に対応できたので記しておく。

結論

pyautoguiと一緒にインストールされる外部ライブラリ「PyMsgBox」で異常が発生していると予想。
pyautoguiインストール前にPyMsgBoxの最新ver.の一つ前のver.1.0.7を個別にインストールしておき、
その後、pyautoguiをインストールする
ことでエラーを回避してインストールすることができた。
pipで最新verでないライブラリをインストールするには、以下のようにver.を指定してインストールを行なう。
pip install PyMsgBox==1.0.7

エラー内容

Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\aaa\desktop\python\test_env\scripts\python.exe' 'c:\users\aaa\desktop\python\test_env\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 
'C:\Users\aaa\AppData\Local\Temp\tmpu281egyw'
         cwd: C:\Users\aaa\AppData\Local\Temp\pip-install-d2sptygb\pymsgbox
    Complete output (14 lines):
    running dist_info22:17 2020/05/24
    creating C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info
    writing C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info\PKG-INFO
    writing dependency_links to C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info\dependency_links.txt
    writing top-level names to C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info\top_level.txt
    writing manifest file 'C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info\SOURCES.txt'
    reading manifest file 'C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x8e in position 0: invalid start byte (sitecustomize.py, line 7)
    warning: no files found matching '*.py' under directory 'pymsgbox'
    writing manifest file 'C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.egg-info\SOURCES.txt'
    creating 'C:\Users\aaa\AppData\Local\Temp\pip-modern-metadata-exbqlb5h\PyMsgBox.dist-info'
    error: invalid command 'bdist_wheel'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\aaa\desktop\python\test_env\scripts\python.exe' 'c:\users\aaa\desktop\python\test_env\lib\site-packages\pip\_vendor\pep517\_in_process.py' 
prepare_metadata_for_build_wheel 'C:\Users\aaa\AppData\Local\Temp\tmpu281egyw' Check the logs for full command output.

エラー内容はほとんど読み解けていないが、やたらPyMsgBoxという単語が目についた。
PyMsgBoxの公式サイトを確認してみたところ、最新ver.の1.0.8が2020/05/12にリリースされている。
これが影響してしまっているのでは、と疑い、ひとまずダウングレードしてみたところ
無事(?)pyautoguiをインストールできた。

環境

  • Windows10 Home
  • Python3.8(32bit)
  • Visual Studio Code 1.45.1
  • (venvコマンドで作成した仮想環境)

その他試してみたこと

  • pipのアップデート ⇒ 効果なし
  • pip3のアップデート及びpip3によるインストール ⇒ 効果なし
  • 総合ターミナルの文字コード確認および変更
    • 総合ターミナルでchcpと入力し、エンターを押すと現在の文字コードが出る。(932はShift-JIS)
    • chcp 65501で文字コードUTF-8に変更後、そのままpipでインストール ⇒ 効果なし
  • Pillowのインストール ⇒ 効果なし

所感など

上記の通り、根本的な解決には至っていない。
今回のエラーの原因か不明だが、Pythonでは文字コードによるエラーも多発するとのことなので、
その辺りも今後勉強していきたい。

(もしエラー内容の意味が分かる方がいればご教示ください)

3
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2