LoginSignup
3
1

More than 5 years have passed since last update.

pipenvでハッシュが一致しない時のワークアラウンド

Posted at

問題

pipenvでgoogle-auth-httplib2を導入しようとしたところ、次のようなエラーが出ました。

[pipenv.exceptions.InstallError]: ['Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simole', 'Collecting httplib2==0.12.0 (from -r /tmp/pipenv-jepk7o2l-requirements/pipenv-jnmz66u5-requirement.txt (line 1))', '  Using cached https://www.piwheels.org/simple/httplib2/httplib2-0.12.0-py3-none-any.whl']
[pipenv.exceptions.InstallError]: ['THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.', '    httplib2==0.12.0 from https://www.piwheels.org/simple/httplib2/httplib2-0.12.0-py3-none-any.whl#sha256=c3232dbdda3c30966b97bed348d7847fcd5c35d095580a46c8b2e3a62b67d7fb (from -r /tmp/pipenv-jepk7o2l-requirements/pipenv-jnmz66u5-requirement.txt (line 1)):', '        Expected sha256 f61fb838a94ce3b349aa32c92fd8430f7e3511afdb18bf9640d647e30c90a6d6', '             Got        c3232dbdda3c30966b97bed348d7847fcd5c35d095580a46c8b2e3a62b67d7fb']

httplib2パッケージのハッシュが一致しないとのことですが、調べてみるとc3232...の方はhttps://www.piwheels.org/simple/httplib2/ からのもので、f61f...の方はhttps://pypi.org/simple/httplib2/ からのものでした。

Pipfile.lockに書かれているのはf61f...でしたが、実際にはpiwheelからパッケージをダウンロードしてしまっているようです。

解決策

Hashes generated during locking do not match install · Issue #2540 · pypa/pipenvを参考にして、Pipfileにソースとパッケージを新たに追加しました。

[[source]]
url = "https://www.piwheels.org/simple"
name = "piwheels"
verify_ssl = true

[[packages]]
<略>
httplib2 = { version = "*", index = "piwheels" }

これで無事pipenv installが通るようになりました。

3
1
0

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
1