I'm simply trying to push my Flask app to Heroku but I encountered the following error:
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-qq0uk569/xlwings/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qq0uk569/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-dxixzzkg
remote: cwd: /tmp/pip-install-qq0uk569/xlwings/
remote: Complete output (5 lines):
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-install-qq0uk569/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 browebgen.
remote:
To https://git.heroku.com/browebgen.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/browebgen.git'
I'm not sure what I need to do to get rid of this error.
The error message says it all:
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
You might be using a package in your app named xlwings which is built to be used on Windows and Mac but the servers on Heroku have linux installed on them so you'll first have to set an environment variable INSTALL_ON_LINUX to 1 then try to deploy the app again.
From the Heroku CLI you can do:
heroku config:set INSTALL_ON_LINUX=1
Related
I have problem when i try to push my app on heroku,
so when i write git push heroku master this error is appear
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-48na90v5/importlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-48na90v5/importlib/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-dccx97n0
remote: cwd: /tmp/pip-install-48na90v5/importlib/
remote: Complete output (11 lines):
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
remote: import distutils.core
remote: File "/app/.heroku/python/lib/python3.6/distutils/core.py", line 16, in <module>
remote: from distutils.dist import Distribution
remote: File "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 19, in <module>
remote: from distutils.util import check_environ, strtobool, rfc822_escape
remote: File "/app/.heroku/python/lib/python3.6/distutils/util.py", line 9, in <module>
remote: import importlib.util
remote: ModuleNotFoundError: No module named 'importlib.util'
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
Most probably it is the issue with libraries you are trying to install check for the versions as currently heroku uses latest version of python
or just change the python version specific to your project on heroku by using runtime.txt file in your root directory
I had also faced the exact same issue which I fixed by installing latest versions of the dependencies.
Try; definitely it will work.
I'm having issues deploying my bot i made using discord.py into discord using heroku. I've followed many guides and looked into mane other sources as well to why it is happening and nothing seems to be working. This is what i get....
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.10
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting git+https://github.com/tony1bally/education-helper (from -r /tmp/build_e8b937d57bb9efdeafd512bb63149ee1/requirements.txt (line 1))
remote: Cloning https://github.com/tony1bally/education-helper to /tmp/pip-req-build-7hfbm1vc
remote: Running command git clone -q https://github.com/tony1bally/education-helper /tmp/pip-req-build-7hfbm1vc
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-req-build-7hfbm1vc/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-7hfbm1vc/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-req-build-7hfbm1vc/pip-egg-info
remote: cwd: /tmp/pip-req-build-7hfbm1vc/
remote: Complete output (5 lines):
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/app/.heroku/python/lib/python3.6/tokenize.py", line 452, in open
remote: buffer = _builtin_open(filename, 'rb')
remote: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-7hfbm1vc/setup.py'
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 education-helper.
remote:
To https://git.heroku.com/education-helper.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/education-helper.git'
Does anyone know why this is happening?
This is through the command prompt btw!
You've declared https://github.com/tony1bally/education-helper as a dependency in requirements.txt but the repository is empty and cannot be installed with pip as a Python module.
Remove it from requirements.txt, add, commit and push again.
I'm trying to use the playsound module in a very simple Django app with the below code which plays an mp3 file:
from playsound import playsound
playsound(filename)
However, my push to Heroku fails at PyOBjC (which is apparently also needed). I've pip installed playsound and PyObjC (without PyObjC, my play fails for needing AppKit). With both modules installed, the application works great on my local server.
It all works great until the Heroku build. Snippet of the error below. Does anyone have any ideas for what I need to do to get this build to work?
...
remote: Collecting pyobjc-core==6.1
remote: Downloading pyobjc-core-6.1.tar.gz (791 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-l_hzqzmw/pyobjc-core/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l_hzqzmw/pyobjc-core/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-install-l_hzqzmw/pyobjc-core/pip-egg-info
remote: cwd: /tmp/pip-install-l_hzqzmw/pyobjc-core/
remote: Complete output (4 lines):
remote: /app/.heroku/python/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
remote: warnings.warn(msg)
remote: running egg_info
remote: error: PyObjC requires macOS to build
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 db-devsite.
remote:
To https://git.heroku.com/db-devsite.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/db-devsite.git'
The playsound module only has a dependency on PyObjC when used on macOS, for Linux machines (such as Heroku) the library has a dependency on "PyGObject" and the GStreamer library.
Note that playsound plays the sound on the machine that's running the code, which is probably not what you want when you use Heroku (it will try to play the sound a machine at Heroku).
I am trying to deploy a Flask app on Heroku which responds to JSON post requests after doing some data analysis on a big JSON dataset. I referred to this question: No package 'gobject-introspection-1.0' found while deploying to Heroku but it's still not working.
requirements.txt:
flask
pandas
gunicorn
flask_cors
gdown
Package gobject-introspection-1.0 was not found in the pkg-config search path.
remote: Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
remote: to the PKG_CONFIG_PATH environment variable
remote: No package 'gobject-introspection-1.0' found
remote: Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.
remote:
remote: Try installing it with: 'sudo apt install libgirepository1.0-dev'
remote:
remote: ----------------------------------------
remote: Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3ejh6vw4/PyGObject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-lgaouqha-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-3ejh6vw4/PyGObject/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to stormy-castle-60587.
You can try to reach your slug with heroku run bash --app appname and then try to install libgirepository1.0-dev. In case of failure, use heroku-community/apt, more info at heroku-buildpack-apt
Attempted to deploy python web app to heroku but encountered the following errors:
remote: running build_ext
remote: Package gobject-introspection-1.0 was not found in the pkg-config search path.
remote: Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
remote: to the PKG_CONFIG_PATH environment variable
remote: No package 'gobject-introspection-1.0' found
remote: Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.
remote:
remote: Try installing it with: 'sudo apt install libgirepository1.0-dev'
remote:
remote: ----------------------------------------
remote: Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-l6sq2i_i/PyGObject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-k7lo0r2b-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-l6sq2i_i/PyGObject/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to ggoh-trailer.
remote:
To https://git.heroku.com/ggoh-trailer.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ggoh-trailer.git'
OS = Ubuntu 18.04(Bionic)
Python 3.7.1
In requirements.txt:
pycairo==1.18.0
PyGObject==3.30.2
I've installed libgirepository1.0-dev as below;
$ whereis gobject-introspection-1.0
gobject-introspection-1: /usr/include/gobject-introspection-1.0 /usr/share/gobject-introspection-1.
But I still see the same error above. Are there any other applications that I need to install on Ubuntu to fulfill the dependency?
After manually editing requirement.txt files with content below;
Flask
gunicorn
Heroku was able to accept my git push. I've learned to only use the required dependencies in requirement.txt. Thanks Chris for point me to the right direction.