Pipenv 无法在远程服务器 (Heroku) 上安装 boto3
Pipenv fails to install boto3 on remote server (Heroku)
我成功部署了我的 django 项目,然后我想使用 AWS S3 来提供静态文件。所以我安装了所需的软件包,一切都在本地运行。但是现在当我尝试 git push heroku master
它失败并出现以下回溯:
Writing objects: 100% (370/370), 5.85 MiB | 2.92 MiB/s, done.
Total 370 (delta 69), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.6.10
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: cp: cannot create regular file '/app/tmp/cache/.heroku/requirements.txt': No such file or directory
remote: -----> Installing python-3.6.9
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Installing dependencies from Pipfile.lock (acd4c8)…
remote: An error occurred while installing boto3==1.12.31! Will try again.
remote: Installing initially–failed dependencies…
remote: Collecting boto3==1.12.31
remote: Using cached https://files.pythonhosted.org/packages/2a/4f/3facbb42e8d07db1ef9b8cefb28dd1dbfcd52a8e32a0323d57f59b10e147/boto3-1.12.31-py2.py3-none-any.whl
remote:
remote: THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
remote: boto3==1.12.31 from https://files.pythonhosted.org/packages/2a/4f/3facbb42e8d07db1ef9b8cefb28dd1dbfcd52a8e32a0323d57f59b10e147/boto3-1.12.31-py2.py3-none-any.whl#sha256=8bf7e3611d46e8214bf225169ac55de762d9d341514f81ebae885dd601138fcf (from -r /tmp/pipenv-sdy5o9v6-requirements/pipenv-k_8vold6-requirement.txt (line 1)):
remote: Expected sha256 913fc7bbb9df147ed6fa0bd2b391469652ee8cad3e26ca2355e6ff774d9516fb
remote: Got 8bf7e3611d46e8214bf225169ac55de762d9d341514f81ebae885dd601138fcf
remote:
remote: You are using pip version 9.0.2, however version 20.0.2 is available.
remote: You should consider upgrading via the 'pip install --upgrade pip' command.
remote:
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shielded-coast-69749.
remote:
To https://git.heroku.com/shielded-coast-69749.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielded-coast-69749.git'
以前我在尝试在本地安装 psycopg2 时遇到过类似的问题,但经过多次尝试后仍然没有找到任何解决方法(改为安装 psycopg2-binary)。所以在这里我也感到有点绝望。我尝试了 pipenv sync
、pipenv update
,最终我用一个新的 venv 重新启动了,但它没有帮助。如果我尝试通过 heroku 的 bash 安装 boto3,它会起作用。但这并不能解决问题,因为文件被锁定了。
django-storages 依赖于 boto3 1.4.4 及以上版本,但 pipenv 安装了 3 月 28.So 发布的 1.12.31,heroku 和 pypi.org 之间可能缓存不匹配。所以你可以通过使用以下命令手动安装 boto3 来降级 boto3
pipenv install "boto=1.4.4"
我指定了 1.4.4,因为它是 django 要求的最低版本-storages.But您可以安装 1.4.4 以上的任何版本。
我成功部署了我的 django 项目,然后我想使用 AWS S3 来提供静态文件。所以我安装了所需的软件包,一切都在本地运行。但是现在当我尝试 git push heroku master
它失败并出现以下回溯:
Writing objects: 100% (370/370), 5.85 MiB | 2.92 MiB/s, done.
Total 370 (delta 69), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.6.10
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: cp: cannot create regular file '/app/tmp/cache/.heroku/requirements.txt': No such file or directory
remote: -----> Installing python-3.6.9
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Installing dependencies from Pipfile.lock (acd4c8)…
remote: An error occurred while installing boto3==1.12.31! Will try again.
remote: Installing initially–failed dependencies…
remote: Collecting boto3==1.12.31
remote: Using cached https://files.pythonhosted.org/packages/2a/4f/3facbb42e8d07db1ef9b8cefb28dd1dbfcd52a8e32a0323d57f59b10e147/boto3-1.12.31-py2.py3-none-any.whl
remote:
remote: THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
remote: boto3==1.12.31 from https://files.pythonhosted.org/packages/2a/4f/3facbb42e8d07db1ef9b8cefb28dd1dbfcd52a8e32a0323d57f59b10e147/boto3-1.12.31-py2.py3-none-any.whl#sha256=8bf7e3611d46e8214bf225169ac55de762d9d341514f81ebae885dd601138fcf (from -r /tmp/pipenv-sdy5o9v6-requirements/pipenv-k_8vold6-requirement.txt (line 1)):
remote: Expected sha256 913fc7bbb9df147ed6fa0bd2b391469652ee8cad3e26ca2355e6ff774d9516fb
remote: Got 8bf7e3611d46e8214bf225169ac55de762d9d341514f81ebae885dd601138fcf
remote:
remote: You are using pip version 9.0.2, however version 20.0.2 is available.
remote: You should consider upgrading via the 'pip install --upgrade pip' command.
remote:
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shielded-coast-69749.
remote:
To https://git.heroku.com/shielded-coast-69749.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielded-coast-69749.git'
以前我在尝试在本地安装 psycopg2 时遇到过类似的问题,但经过多次尝试后仍然没有找到任何解决方法(改为安装 psycopg2-binary)。所以在这里我也感到有点绝望。我尝试了 pipenv sync
、pipenv update
,最终我用一个新的 venv 重新启动了,但它没有帮助。如果我尝试通过 heroku 的 bash 安装 boto3,它会起作用。但这并不能解决问题,因为文件被锁定了。
django-storages 依赖于 boto3 1.4.4 及以上版本,但 pipenv 安装了 3 月 28.So 发布的 1.12.31,heroku 和 pypi.org 之间可能缓存不匹配。所以你可以通过使用以下命令手动安装 boto3 来降级 boto3
pipenv install "boto=1.4.4"
我指定了 1.4.4,因为它是 django 要求的最低版本-storages.But您可以安装 1.4.4 以上的任何版本。