Saloni Shah
Saloni Shah

Reputation: 23

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.

This is my first time using Heroku and Dash and Plotly. I am trying to deploy this app for my team. I have not saved the code on GitHub. The error I am getting is "failed to push some refs to..."

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'

Upvotes: 0

Views: 462

Answers (1)

Chris
Chris

Reputation: 137071

xlwings requires an installation of Excel and therefore only works on Windows and macOS

Heroku does not run Windows or macOS (it runs Linux) and therefore you cannot use xlwings on Heroku.

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.

Maybe you're confused about how xlwings works? You might be running Windows or macOS locally, and you might well have Excel available. But the code you deploy to Heroku runs there, and has no way to access Excel on your machine.

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.

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. It should run on Heroku.

But it might not do what you want—xlwings can do some neat stuff that openpyxl can't.

Upvotes: 3

Related Questions