Heroku:编译的 Slug 大小太大 Python
Heroku: Compiled Slug Size is too large Python
我正在尝试将我的应用程序部署到 heroku
我有以下部署错误
transformers 4.8.2 requires huggingface-hub==0.0.12, but you'll have huggingface-hub 0.0.14 which is incompatible.
Successfully installed MarkupSafe-2.0.1 Send2Trash-1.7.1 altair-4.1.0 argon2-cffi-20.1.0 astor-0.8.1 async-generator-1.10 attrs-21.2.0 backcall-0.2.0 base58-2.1.0 beautifulsoup4-4.9.3 bleach-3.3.1 blinker-1.4 cachetools-4.2.2 certifi-2021.5.30 cffi-1.14.6 charset-normalizer-2.0.3 click-7.1.2 cloudscraper-1.2.58 debugpy-1.3.0 decorator-5.0.9 defusedxml-0.7.1 entrypoints-0.3 filelock-3.0.12 gitdb-4.0.7 gitpython-3.1.18 huggingface-hub-0.0.14 idna-3.2 ipykernel-6.0.3 ipython-7.25.0 ipython-genutils-0.2.0 ipywidgets-7.6.3 jedi-0.18.0 jinja2-3.0.1 joblib-1.0.1 jsonschema-3.2.0 jupyter-client-6.1.12 jupyter-core-4.7.1 jupyterlab-pygments-0.1.2 jupyterlab-widgets-1.0.0 matplotlib-inline-0.1.2 mistune-0.8.4 nbclient-0.5.3 nbconvert-6.1.0 nbformat-5.1.3 nest-asyncio-1.5.1 nltk-3.6.2 notebook-6.4.0 numpy-1.21.0 packaging-21.0 pandas-1.2.5 pandocfilters-1.4.3 parso-0.8.2 pexpect-4.8.0 pickleshare-0.7.5 pillow-8.3.1 prometheus-client-0.11.0 prompt-toolkit-3.0.19 protobuf-3.17.3 ptyprocess-0.7.0 pycparser-2.20 pydeck-0.6.2 pygments-2.9.0 pyparsing-2.4.7 pyrsistent-0.18.0 python-dateutil-2.8.2 pytz-2021.1 pyyaml-5.4.1 pyzmq-22.1.0 regex-2021.7.6 requests-2.26.0 requests-toolbelt-0.9.1 sacremoses-0.0.45 scikit-learn-0.24.2 scipy-1.7.0 sentence-transformers-2.0.0 sentencepiece-0.1.96 six-1.16.0 smmap-4.0.0 soupsieve-2.2.1 streamlit-0.84.1 terminado-0.10.1 testpath-0.5.0 threadpoolctl-2.2.0 tokenizers-0.10.3 toml-0.10.2 toolz-0.11.1 torch-1.9.0 torchvision-0.10.0 tornado-6.1 tqdm-4.61.2 traitlets-5.0.5 transformers-4.8.2 typing-extensions-3.10.0.0 tzlocal-2.1 urllib3-1.26.6 validators-0.18.2 watchdog-2.1.3 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.1
-----> Downloading NLTK corpora…
! 'nltk.txt' not found, not downloading any corpora
! Learn more: https://devcenter.heroku.com/articles/python-nltk
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
! Compiled slug size: 1014.9M is too large (max is 500M).
! See: http://devcenter.heroku.com/articles/slug-size
! Push failed
我无法弄清楚哪个库或依赖项太大以至于 heroku 无法部署它
允许的最大 slug 大小为 500MB。 Slugs 是 heroku 的一个重要方面。当您 git 推送到 Heroku 时,slug 编译器会接收您的代码,它将您的存储库转换为 slug。
首先,让我们确定哪些文件在您的 slug 中占用了相当数量的 space。为此,请启动您的 heroku cli 并通过键入以下内容进入/访问您的 dyno:
heroku run bash -a <appname>
然后,通过执行以下操作对 dyno 中存在的所有文件进行排序:
du -ha --max-depth 1 /app | sort -hr
这会让您了解哪些文件占用了多少 space。
现在,我们可以继续减小 slug 的大小。有几种方法可以减小 slug 的大小(假设您使用 Heroku cli 来部署您的应用程序:
1. 使用第三方云存储:减少 slug 大小的一种流行方法。 Heroku 支持 Amazon S3 和 Cloudinary 等。我更喜欢亚马逊 S3。这是 how to setup S3 for Heroku 上的文档。移动您的大文件并将它们托管在那里。这将显着减小您的 slug 大小。
2。 Using .slugignore
:我可以看到您正在 heroku 上部署某种 ML 应用程序。好吧,ML 应用程序的规模往往非常大,而且它们经常会在部署阶段引起问题。这就是 .slugignore
变得非常有用的地方。您可以告诉 slug 编译器忽略 slug 编译器 一些不必要的文件,例如图像、测试数据集、媒体等等。有关如何使用 .slugignore
的更多信息,请参见 here in the official documentation
我正在尝试将我的应用程序部署到 heroku
我有以下部署错误
transformers 4.8.2 requires huggingface-hub==0.0.12, but you'll have huggingface-hub 0.0.14 which is incompatible.
Successfully installed MarkupSafe-2.0.1 Send2Trash-1.7.1 altair-4.1.0 argon2-cffi-20.1.0 astor-0.8.1 async-generator-1.10 attrs-21.2.0 backcall-0.2.0 base58-2.1.0 beautifulsoup4-4.9.3 bleach-3.3.1 blinker-1.4 cachetools-4.2.2 certifi-2021.5.30 cffi-1.14.6 charset-normalizer-2.0.3 click-7.1.2 cloudscraper-1.2.58 debugpy-1.3.0 decorator-5.0.9 defusedxml-0.7.1 entrypoints-0.3 filelock-3.0.12 gitdb-4.0.7 gitpython-3.1.18 huggingface-hub-0.0.14 idna-3.2 ipykernel-6.0.3 ipython-7.25.0 ipython-genutils-0.2.0 ipywidgets-7.6.3 jedi-0.18.0 jinja2-3.0.1 joblib-1.0.1 jsonschema-3.2.0 jupyter-client-6.1.12 jupyter-core-4.7.1 jupyterlab-pygments-0.1.2 jupyterlab-widgets-1.0.0 matplotlib-inline-0.1.2 mistune-0.8.4 nbclient-0.5.3 nbconvert-6.1.0 nbformat-5.1.3 nest-asyncio-1.5.1 nltk-3.6.2 notebook-6.4.0 numpy-1.21.0 packaging-21.0 pandas-1.2.5 pandocfilters-1.4.3 parso-0.8.2 pexpect-4.8.0 pickleshare-0.7.5 pillow-8.3.1 prometheus-client-0.11.0 prompt-toolkit-3.0.19 protobuf-3.17.3 ptyprocess-0.7.0 pycparser-2.20 pydeck-0.6.2 pygments-2.9.0 pyparsing-2.4.7 pyrsistent-0.18.0 python-dateutil-2.8.2 pytz-2021.1 pyyaml-5.4.1 pyzmq-22.1.0 regex-2021.7.6 requests-2.26.0 requests-toolbelt-0.9.1 sacremoses-0.0.45 scikit-learn-0.24.2 scipy-1.7.0 sentence-transformers-2.0.0 sentencepiece-0.1.96 six-1.16.0 smmap-4.0.0 soupsieve-2.2.1 streamlit-0.84.1 terminado-0.10.1 testpath-0.5.0 threadpoolctl-2.2.0 tokenizers-0.10.3 toml-0.10.2 toolz-0.11.1 torch-1.9.0 torchvision-0.10.0 tornado-6.1 tqdm-4.61.2 traitlets-5.0.5 transformers-4.8.2 typing-extensions-3.10.0.0 tzlocal-2.1 urllib3-1.26.6 validators-0.18.2 watchdog-2.1.3 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.1
-----> Downloading NLTK corpora…
! 'nltk.txt' not found, not downloading any corpora
! Learn more: https://devcenter.heroku.com/articles/python-nltk
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
! Compiled slug size: 1014.9M is too large (max is 500M).
! See: http://devcenter.heroku.com/articles/slug-size
! Push failed
我无法弄清楚哪个库或依赖项太大以至于 heroku 无法部署它
允许的最大 slug 大小为 500MB。 Slugs 是 heroku 的一个重要方面。当您 git 推送到 Heroku 时,slug 编译器会接收您的代码,它将您的存储库转换为 slug。
首先,让我们确定哪些文件在您的 slug 中占用了相当数量的 space。为此,请启动您的 heroku cli 并通过键入以下内容进入/访问您的 dyno:
heroku run bash -a <appname>
然后,通过执行以下操作对 dyno 中存在的所有文件进行排序:
du -ha --max-depth 1 /app | sort -hr
这会让您了解哪些文件占用了多少 space。
现在,我们可以继续减小 slug 的大小。有几种方法可以减小 slug 的大小(假设您使用 Heroku cli 来部署您的应用程序:
1. 使用第三方云存储:减少 slug 大小的一种流行方法。 Heroku 支持 Amazon S3 和 Cloudinary 等。我更喜欢亚马逊 S3。这是 how to setup S3 for Heroku 上的文档。移动您的大文件并将它们托管在那里。这将显着减小您的 slug 大小。
2。 Using .slugignore
:我可以看到您正在 heroku 上部署某种 ML 应用程序。好吧,ML 应用程序的规模往往非常大,而且它们经常会在部署阶段引起问题。这就是 .slugignore
变得非常有用的地方。您可以告诉 slug 编译器忽略 slug 编译器 一些不必要的文件,例如图像、测试数据集、媒体等等。有关如何使用 .slugignore
的更多信息,请参见 here in the official documentation