简体   繁体   English

Heroku 部署 Dash 应用程序时出现应用程序错误:“OSError:xlwings 需要安装 Excel,因此仅适用于 Windows 和 macOS。”

[英]Heroku application error when deploying Dash app: "OSError: xlwings requires an installation of Excel and therefore only works on Windows and macOS."

I am getting an error when I am trying to deploy a Dash app to Heroku.当我尝试将 Dash 应用程序部署到 Heroku 时出现错误。

This is my first time using Heroku and Dash and Plotly. I am trying to deploy this app for my team.这是我第一次使用 Heroku 和 Dash 以及 Plotly。我正在尝试为我的团队部署这个应用程序。 I have not saved the code on GitHub. The error I am getting is "failed to push some refs to..."我没有在 GitHub 上保存代码。我得到的错误是“无法将一些引用推送到...”

The complete issue is shown below.完整的问题如下所示。

remote:        Collecting xlwings==0.20.4
remote:          Downloading xlwings-0.20.4.tar.gz (647 kB)
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pamtz4zz/xlwings/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pamtz4zz/xlwings/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-jxny1ijq
remote:                 cwd: /tmp/pip-install-pamtz4zz/xlwings/
remote:            Complete output (5 lines):
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-pamtz4zz/xlwings/setup.py", line 32, in <module>
remote:                raise OSError("xlwings requires an installation of Excel and therefore only works on Windows and macOS. To enable the installation on Linux nevertheless, do: export INSTALL_ON_LINUX=1; pip install xlwings")
remote:            OSError: xlwings requires an installation of Excel and therefore only works on Windows and macOS. To enable the installation on Linux nevertheless, do: export INSTALL_ON_LINUX=1; pip install xlwings
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to dash.
remote: 
To https://git.heroku.com/dash.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dash.git'

xlwings requires an installation of Excel and therefore only works on Windows and macOS xlwings 需要安装 Excel,因此仅适用于 Windows 和 macOS

Heroku does not run Windows or macOS (it runs Linux) and therefore you cannot use xlwings on Heroku. Heroku 不运行 Windows 或 macOS(它运行 Linux),因此您不能在xlwings上使用 xlwings。

Setting INSTALL_ON_LINUX=1 bypasses this check and lets installation proceed, but it doesn't change the fact that Heroku is running Linux, not Windows or macOS, and it certainly doesn't provide Excel.设置INSTALL_ON_LINUX=1绕过此检查并让安装继续进行,但它不会改变 Heroku 正在运行 Linux 而不是 Windows 或 macOS 的事实,并且它当然不提供 Excel。

Maybe you're confused about how xlwings works?也许您对xlwings工作原理感到困惑? You might be running Windows or macOS locally, and you might well have Excel available.您可能在本地运行 Windows 或 macOS,并且很可能有 Excel 可用。 But the code you deploy to Heroku runs there , and has no way to access Excel on your machine.但是你部署到 Heroku 的代码在那里运行,并且无法访问你机器上的 Excel。

You might want to read through What is the difference between client-side and server-side programming?您可能想通读客户端编程和服务器端编程有什么区别? The code you deploy to Heroku runs server-side .您部署到 Heroku 的代码在服务器端运行。

I have no idea what you're trying to do with Excel, but there are other Excel libraries available for Python. Something like openpyxl might be able to take the place of xlwings in your application.我不知道你想用 Excel 做什么,但还有其他 Excel 库可用于 Python。像openpyxl这样的东西可能会在你的应用程序中取代xlwings It should run on Heroku.它应该在 Heroku 上运行。

But it might not do what you want— xlwings can do some neat stuff that openpyxl can't.但它可能不会做你想做的事xlwings可以做一些openpyxl做不到的巧妙的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM