How to include non-Python dependencies in a Python Django deployment? - python

I am deploying a Django application using Heroku. One of my application's dependencies is the 'ta-lib' library, which is a Python wrapper for a library written in C. To get this to work locally, I simply had to download the underlying C library and the program would pick up what it needed from /usr/local and I had no problems.
Library reference: https://mrjbq7.github.io/ta-lib/install.html
Now, when I'm trying to push my files to Heroku via Git, the build fails at this library. Here is the terminal output, starting from where the errors began:
remote: Building wheel for TA-Lib (setup.py): started
remote: Building wheel for TA-Lib (setup.py): finished with status 'error'
remote: ERROR: Command errored out with exit status 1:
remote: command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ya1rkeoc/ta-lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ya1rkeoc/ta-lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-e83ejfm_
remote: cwd: /tmp/pip-install-ya1rkeoc/ta-lib/
remote: Complete output (27 lines):
remote: /tmp/pip-install-ya1rkeoc/ta-lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
remote: warnings.warn('Cannot find ta-lib library, installation may fail.')
remote: running bdist_wheel
remote: running build
remote: running build_py
remote: creating build
remote: creating build/lib.linux-x86_64-3.9
remote: creating build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_data.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_func.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/stream.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/__init__.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_abstract.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/abstract.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/deprecated.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_pandas.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_stream.py -> build/lib.linux-x86_64-3.9/talib
remote: running build_ext
remote: building 'talib._ta_lib' extension
remote: creating build/temp.linux-x86_64-3.9
remote: creating build/temp.linux-x86_64-3.9/talib
remote: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/tmp/pip-install-ya1rkeoc/ta-lib/.eggs/numpy-1.20.3-py3.9-linux-x86_64.egg/numpy/core/include -I/app/.heroku/python/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.9/talib/_ta_lib.o
remote: talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory
remote: 611 | #include "ta-lib/ta_defs.h"
remote: | ^~~~~~~~~~~~~~~~~~
remote: compilation terminated.
remote: error: command '/usr/bin/gcc' failed with exit code 1
remote: ----------------------------------------
remote: ERROR: Failed building wheel for TA-Lib
remote: Running setup.py clean for TA-Lib
remote: Building wheel for wrapt (setup.py): started
remote: Building wheel for wrapt (setup.py): finished with status 'done'
remote: Created wheel for wrapt: filename=wrapt-1.12.1-cp39-cp39-linux_x86_64.whl size=78588 sha256=bcbc0270be5d84ca062d30a118d3e1b5bb48b1eb96ca15d72db3ba00e95e33dc
remote: Stored in directory: /tmp/pip-ephem-wheel-cache-xcx232so/wheels/98/23/68/efe259aaca055e93b08e74fbe512819c69a2155c11ba3c0f10
remote: Successfully built lazy-object-proxy wrapt
remote: Failed to build TA-Lib
remote: Installing collected packages: asgiref, six, wrapt, lazy-object-proxy, astroid, certifi, chardet, Cython, pytz, sqlparse, Django, gunicorn, idna, isort, mccabe, numpy, urllib3, requests, pycoingecko, toml, pylint, TA-Lib, typed-ast
remote: Running setup.py install for TA-Lib: started
remote: Running setup.py install for TA-Lib: finished with status 'error'
remote: ERROR: Command errored out with exit status 1:
remote: command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ya1rkeoc/ta-lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ya1rkeoc/ta-lib/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-record-l9p7ava0/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.9/TA-Lib
remote: cwd: /tmp/pip-install-ya1rkeoc/ta-lib/
remote: Complete output (28 lines):
remote: /tmp/pip-install-ya1rkeoc/ta-lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
remote: warnings.warn('Cannot find ta-lib library, installation may fail.')
remote: running install
remote: running build
remote: running build_py
remote: creating build
remote: creating build/lib.linux-x86_64-3.9
remote: creating build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_data.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_func.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/stream.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/__init__.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_abstract.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/abstract.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/deprecated.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_pandas.py -> build/lib.linux-x86_64-3.9/talib
remote: copying talib/test_stream.py -> build/lib.linux-x86_64-3.9/talib
remote: running build_ext
remote: skipping 'talib/_ta_lib.c' Cython extension (up-to-date)
remote: building 'talib._ta_lib' extension
remote: creating build/temp.linux-x86_64-3.9
remote: creating build/temp.linux-x86_64-3.9/talib
remote: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/lib/python3.9/site-packages/numpy/core/include -I/app/.heroku/python/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.9/talib/_ta_lib.o
remote: talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory
remote: 611 | #include "ta-lib/ta_defs.h"
remote: | ^~~~~~~~~~~~~~~~~~
remote: compilation terminated.
remote: error: command '/usr/bin/gcc' failed with exit code 1
remote: ----------------------------------------
remote: ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ya1rkeoc/ta-lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ya1rkeoc/ta-lib/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-record-l9p7ava0/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.9/TA-Lib 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 <my-app-name>.
remote:
To https://git.heroku.com/<my-app-name>.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/<my-app-name>.git'enter code here
How do I determine which files from the underlying C library are needed and where do I add them to my Django project when pushing my code?
Thank you.

Related

Failed to run TA-lib Python on Heroku

I want to deploy an app using Heroku but it did not manage to build it. See my build logs under this message.
It looks that my problem is that it cannot load/install Ta-Lib (package that I want to use).
I have 4 documents in my git project:
Procfile
worker: python StrategyMade.py
1 file with my python code called StrategyMade.py
config.json (which is settings that I need for the python code)
requirements.txt (all my packages used)
freqtrade
pandas
numpy
matplotlib
I read online that I need to have buildpacks for Ta-lib so I installed Heroku CLI and then went to terminal and typed the commands in my terminal:
heroku buildpacks:add --index 1 heroku/python -a "name of my project"
heroku buildpacks:add --index 2 numrut/ta-lib -a "name of my project"
and checked if this is added which is true:
screenshot
I ran the app but it gave me some errors. Can someone help me to figure out what is wrong and how I can solve this?Thanks!
Here are my build logs
Building wheel for blosc (PEP 517): finished with status 'done'
Created wheel for blosc: filename=blosc-1.10.2-cp36-cp36m-linux_x86_64.whl size=2311541 sha256=ceefb8ef23ea2204edd8b3551f2052561c4b9d39d3262c8b0e08b7329f35a7fa
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/25/ac/11/5268f9b74f868f4c55d3fa63e4e350543d93e4bd1035e66bfd
Building wheel for TA-Lib (setup.py): started
Building wheel for TA-Lib (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iwphzu1f/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iwphzu1f/TA-Lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-s_lykcmr
cwd: /tmp/pip-install-iwphzu1f/TA-Lib/
Complete output (27 lines):
/tmp/pip-install-iwphzu1f/TA-Lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/tmp/pip-install-iwphzu1f/TA-Lib/.eggs/numpy-1.19.5-py3.6-linux-x86_64.egg/numpy/core/include -I/app/.heroku/python/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory
611 | #include "ta-lib/ta_defs.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for TA-Lib
Running setup.py clean for TA-Lib
Building wheel for sdnotify (setup.py): started
Building wheel for sdnotify (setup.py): finished with status 'done'
Created wheel for sdnotify: filename=sdnotify-0.3.2-py3-none-any.whl size=3212 sha256=1361286b816e23a732caf82e2b98021e5b86ad57082d47b40339832ce585e4fc
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/ad/c7/fb/b9012fda1d8f9e7749915eab363b35fcd09b3a7f699f2a5ae1
Building wheel for wrapt (setup.py): started
Building wheel for wrapt (setup.py): finished with status 'done'
Created wheel for wrapt: filename=wrapt-1.12.1-cp36-cp36m-linux_x86_64.whl size=75931 sha256=83225a868b63939b67454f0018cf7ba94c4030e0e31ab09b67f5a5b710eec0d4
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/32/42/7f/23cae9ff6ef66798d00dc5d659088e57dbba01566f6c60db63
Building wheel for py-find-1st (PEP 517): started
Building wheel for py-find-1st (PEP 517): finished with status 'done'
Created wheel for py-find-1st: filename=py_find_1st-1.1.5-cp36-cp36m-linux_x86_64.whl size=36443 sha256=6d269bbd6bc8578f2f937a46c41ab25d8e084b63e170fa02bce30689b5c4642a
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/90/8d/80/93609354b7435b7f4c3d53407658592cb07bb53e40d9b6015e
Building wheel for pyrsistent (setup.py): started
Building wheel for pyrsistent (setup.py): finished with status 'done'
Created wheel for pyrsistent: filename=pyrsistent-0.17.3-cp36-cp36m-linux_x86_64.whl size=129178 sha256=185ff665281b7f54f0da6d0bb6534cee10f21ce9481ae72fda966e100d1812c5
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/34/13/19/294da8e11bce7e563afee51251b9fa878185e14f4b5caf00cb
Building wheel for idna-ssl (setup.py): started
Building wheel for idna-ssl (setup.py): finished with status 'done'
Created wheel for idna-ssl: filename=idna_ssl-1.1.0-py3-none-any.whl size=3161 sha256=57671bb402e032f7df82fbd0ed50792447c82e9a5b7a712f6698c63a78833cfa
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/6a/f5/9c/f8331a854f7a8739cf0e74c13854e4dd7b1af11b04fe1dde13
Building wheel for typing (setup.py): started
Building wheel for typing (setup.py): finished with status 'done'
Created wheel for typing: filename=typing-3.7.4.3-py3-none-any.whl size=26308 sha256=05c526d654cdd48ab5d66e1c8192840c3844d5bce1cbc6cc9da625f772987b43
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/5f/63/c2/b85489bbea28cb5d36cfe197244f898428004fa3caa7a23116
Successfully built blosc sdnotify wrapt py-find-1st pyrsistent idna-ssl typing
Failed to build TA-Lib
Installing collected packages: tabulate, chardet, urllib3, idna, certifi, requests, wcwidth, prompt-toolkit, questionary, numpy, six, python-dateutil, pytz, pandas, blosc, multidict, yarl, pycparser, cffi, cryptography, idna-ssl, attrs, async-timeout, typing-extensions, aiohttp, pycares, typing, aiodns, ccxt, numexpr, tables, MarkupSafe, jinja2, zipp, importlib-metadata, pyrsistent, jsonschema, cachetools, pycoingecko, TA-Lib, sdnotify, greenlet, SQLAlchemy, python-rapidjson, arrow, wrapt, colorama, py-find-1st, tzlocal, APScheduler, tornado, python-telegram-bot, freqtrade, pillow, kiwisolver, pyparsing, cycler, matplotlib
Running setup.py install for TA-Lib: started
Running setup.py install for TA-Lib: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iwphzu1f/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iwphzu1f/TA-Lib/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-record-kyza1uz5/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/TA-Lib
cwd: /tmp/pip-install-iwphzu1f/TA-Lib/
Complete output (27 lines):
/tmp/pip-install-iwphzu1f/TA-Lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/app/.heroku/python/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory
611 | #include "ta-lib/ta_defs.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iwphzu1f/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iwphzu1f/TA-Lib/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-record-kyza1uz5/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/TA-Lib Check the logs for full command output.
! Push rejected, failed to compile Python app.
! Push failed
TA-Lib is a C library. It has a python wrapper with the same name TA-Lib. The C code must be downloaded and compiled before python wrapper installation. According to your log something tries to install wrapper while C library isn't installed to the system. But it seems numrut/ta-lib buildpack is aware of this.
It seems the problem is that freqtrade in your requirements.txt depends on TA-Lib python wrapper. And numrut/ta-lib is trying to install requirements from requirements.txt with pip before it compiles C source and installs TA-Lib wrapper (with pip again). So ta-lib wrapper is trying to be installed twice. And first attempt is made before C sources are compiled which is a fault.
The possible solution would be to remove freqtrade from requirements.txt and somehow execute pip install -r freqtrade after buildpack numrut/ta-lib is executed. But I don't know Heroku and not sure how to do this and if this is possible at all. Another options would be: to fork numrut/ta-lib buildpack and make this change it its scriptm then use own fork instead of it. Or to address this issue to numrut/ta-lib author - perhaps he bypass this problem in his script. Or to address this issue to freqtrade authors and ask them to make own buildpack for Heroku.
If your running Ubuntu, you can run
sudo apt-get update
sudo apt-get install gcc python3.9
You might not even need python3.9, gcc alone might do it
If not ubuntu, use yum or whatever your OS uses

Why I'm getting this error while building docker image?

I got the following error while building a docker image by "docker-compose build".
ERROR: Couldn't connect to Docker daemon at http://127.0.0.1:2375 - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Even if I try with "sudo", I got this:
Building web
Step 1/8 : FROM python:3.8.3-alpine
---> 8ecf5a48c789
Step 2/8 : WORKDIR /usr/src/app
---> Using cache
---> 87bb0088a0ba
Step 3/8 : ENV PYTHONDONTWRITEBYTECODE 1
---> Using cache
---> 4f1a6ddf9e1f
Step 4/8 : ENV PYTHONUNBUFFERED 1
---> Using cache
---> 5d22b6b7a0f5
Step 5/8 : RUN pip install --upgrade pip
---> Using cache
---> 169ee831f728
Step 6/8 : COPY ./requirements.txt .
---> Using cache
---> 4b4351e31632
Step 7/8 : RUN pip install -r requirements.txt
---> Running in a4dae2fe3761
Collecting asgiref==3.2.10
Downloading asgiref-3.2.10-py3-none-any.whl (19 kB)
Collecting cffi==1.14.3
Downloading cffi-1.14.3.tar.gz (470 kB)
Collecting cryptography==3.2.1
Downloading cryptography-3.2.1.tar.gz (540 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-p3ocmpkd/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
cwd: None
Complete output (128 lines):
Collecting setuptools>=40.6.0
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting cffi!=1.11.3,>=1.8
Using cached cffi-1.14.3.tar.gz (470 kB)
Collecting pycparser
Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
Building wheels for collected packages: cffi
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_eoslhz1/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_eoslhz1/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-99ngzpxw
cwd: /tmp/pip-install-_eoslhz1/cffi/
Complete output (50 lines):
unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory
No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module. See
the error messages above. Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code. (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.freenode.net.)
Trying to continue anyway. If you are trying to install CFFI from
a build done in a different context, you can ignore this warning.
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: setuptools, wheel, pycparser, cffi
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_eoslhz1/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_eoslhz1/cffi/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-record-pah2aui6/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-p3ocmpkd/overlay --compile --install-headers /tmp/pip-build-env-p3ocmpkd/overlay/include/python3.8/cffi
cwd: /tmp/pip-install-_eoslhz1/cffi/
Complete output (50 lines):
unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory
No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module. See
the error messages above. Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code. (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.freenode.net.)
Trying to continue anyway. If you are trying to install CFFI from
a build done in a different context, you can ignore this warning.
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_eoslhz1/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_eoslhz1/cffi/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-record-pah2aui6/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-p3ocmpkd/overlay --compile --install-headers /tmp/pip-build-env-p3ocmpkd/overlay/include/python3.8/cffi Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-p3ocmpkd/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
That is my Dockerfile:
# pull official base image
FROM python:3.8.3-alpine
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt
# copy project
COPY . .
and docker-compose.yml:
version: '3.7'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./:/usr/src/app/
ports:
- 8000:8000
env_file:
- ./.env.dev
I will add that I bought my laptop a few months ago, and already had problems with Docker on my previous system on this device (that's one of the reasons I changed my system). I switched from Fedora to Ubuntu.
Additionally, there is no "python" alias for python3 in my shell, and because of the unknown reason I need to put "python3 -m" before simple "pip freeze".
I hope that information may be useful.
Thank You.
.
.
.
After adding a "RUN apk add builder-base" in my Dockerfile, following error appears:
Step 8/9 : RUN pip install -r requirements.txt
---> Running in cd9c74fbd831
Collecting asgiref==3.2.10
Downloading asgiref-3.2.10-py3-none-any.whl (19 kB)
Collecting cffi==1.14.3
Downloading cffi-1.14.3.tar.gz (470 kB)
Collecting cryptography==3.2.1
Downloading cryptography-3.2.1.tar.gz (540 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-gbfaltlj/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
cwd: None
Complete output (104 lines):
Collecting setuptools>=40.6.0
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting cffi!=1.11.3,>=1.8
Using cached cffi-1.14.3.tar.gz (470 kB)
Collecting pycparser
Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
Building wheels for collected packages: cffi
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-myhajkmm/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-myhajkmm/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9jsg5veu
cwd: /tmp/pip-install-myhajkmm/cffi/
Complete output (38 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
15 | #include <ffi.h>
| ^~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: setuptools, wheel, pycparser, cffi
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-myhajkmm/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-myhajkmm/cffi/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-record-s86a1yn7/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-gbfaltlj/overlay --compile --install-headers /tmp/pip-build-env-gbfaltlj/overlay/include/python3.8/cffi
cwd: /tmp/pip-install-myhajkmm/cffi/
Complete output (38 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
15 | #include <ffi.h>
| ^~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-myhajkmm/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-myhajkmm/cffi/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-record-s86a1yn7/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-gbfaltlj/overlay --compile --install-headers /tmp/pip-build-env-gbfaltlj/overlay/include/python3.8/cffi Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-gbfaltlj/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Alpine Linux does not support the binary wheels Python packages ship under the manylinux tag, so you have to compile things like cffi and cryptography yourself. To do so you'll need a compiler and the correct set of headers. This is documented in the cryptography installation documentation for Alpine.
Update September 2021: There is now a musllinux standard which allows binary wheels that work with Alpine. To use them you must have pip 21.2.4 or greater.
in your dockerfile you can use a base image that has more libraries for compiling the dependencies
# pull official base image
FROM python:3.8
this should allow you to compile the app

deploying bot to heroku, can't push bot to heroku

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.

Installing pdftotext library on heroku

pdftotext library is a requirement in requirements.txt. While trying to push to heroku, I get the following error:
remote: Running setup.py install for pdftotext: started
remote: Running setup.py install for pdftotext: finished with status 'error'
remote: Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rnbekz45/pdftotext/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-o0if2tl3-record/install-record.txt --single-version-externally-managed --compile:
remote: /app/.heroku/python/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
remote: warnings.warn(msg)
remote: running install
remote: running build
remote: running build_ext
remote: building 'pdftotext' extension
remote: creating build
remote: creating build/temp.linux-x86_64-3.6
remote: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=0 -I/app/.heroku/python/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
remote: pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
remote: #include <poppler/cpp/poppler-document.h>
remote: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
remote: compilation terminated.
remote: error: command 'gcc' failed with exit status 1
remote:
remote: ----------------------------------------
remote: Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rnbekz45/pdftotext/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-o0if2tl3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-rnbekz45/pdftotext/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
Normally I'd solve this by installing libpoppler-cpp-dev with apt. But on heroku, I don't have root access to do that. Is there a solution for this?
I realize that strictly speaking, this isn't a programming question. But I need this to deploy my program, so I hope the purists here do forgive me.
From How do I install additional software packages that my application requires?:
We don't offer official support for installing extra packages but there are a couple of unsupported options.
One is the experimental heroku-apt-buildpack. You can use this by including any APT package in an Aptfile in your application. The buildpack will then install these packages on the dyno when you deploy your application.
So, to do this, first add the build pack:
heroku buildpacks:add --index 1 heroku-community/apt
Then, create an Aptfile in your source directory with the following contents:
libpoppler-cpp-dev
And deploy as you normally would. Let me know if that helps!

Heroku can't find libssh2.h

I'm trying to deploy a basic Flask application to Heroku.
I've done one before which worked, but now that I've added SSH it won't deploy.
This is my requirements.txt:
Flask==0.12.2
Gunicorn==19.7.1
parallel-ssh==1.2.0
The heroku build log is:
-----> Python app detected
-----> Installing requirements with pip
Collecting parallel-ssh==1.2.0 (from -r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading parallel_ssh-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (1.6MB)
Collecting ssh2-python>=0.6.0 (from parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading ssh2-python-0.7.0.post2.tar.gz (438kB)
Collecting paramiko<2.2 (from parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading paramiko-2.1.4-py2.py3-none-any.whl (173kB)
Collecting gevent>=1.1 (from parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading gevent-1.2.2-cp36-cp36m-manylinux1_x86_64.whl (1.7MB)
Collecting pyasn1>=0.1.7 (from paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading pyasn1-0.4.2-py2.py3-none-any.whl (71kB)
Collecting cryptography>=1.1 (from paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading cryptography-2.1.4-cp36-cp36m-manylinux1_x86_64.whl (2.2MB)
Collecting greenlet>=0.4.10 (from gevent>=1.1->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading greenlet-0.4.12-cp36-cp36m-manylinux1_x86_64.whl (42kB)
Collecting six>=1.4.1 (from cryptography>=1.1->paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography>=1.1->paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
Collecting idna>=2.1 (from cryptography>=1.1->paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading idna-2.6-py2.py3-none-any.whl (56kB)
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=1.1->paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading cffi-1.11.2-cp36-cp36m-manylinux1_x86_64.whl (419kB)
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.1->paramiko<2.2->parallel-ssh==1.2.0->-r /tmp/build_42797fa48b085347364495c1df641f74/SnelleJelle-divulge-c28ba875636d44db493b3f331420150355401c3c/requirements.txt (line 3))
Downloading pycparser-2.18.tar.gz (245kB)
Installing collected packages: ssh2-python, pyasn1, six, asn1crypto, idna, pycparser, cffi, cryptography, paramiko, greenlet, gevent, parallel-ssh
Running setup.py install for ssh2-python: started
Running setup.py install for ssh2-python: finished with status 'error'
Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xqi26x3e/ssh2-python/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-yn7ewtm4-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/ssh2
copying ssh2/_version.py -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/__init__.py -> build/lib.linux-x86_64-3.6/ssh2
running egg_info
writing ssh2_python.egg-info/PKG-INFO
writing dependency_links to ssh2_python.egg-info/dependency_links.txt
writing top-level names to ssh2_python.egg-info/top_level.txt
reading manifest file 'ssh2_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'ssh2_python.egg-info/SOURCES.txt'
copying ssh2/agent.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/channel.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/error_codes.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/exceptions.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/fileinfo.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/listener.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/pkey.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/publickey.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/session.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/sftp.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/sftp_handle.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/statinfo.c -> build/lib.linux-x86_64-3.6/ssh2
copying ssh2/utils.c -> build/lib.linux-x86_64-3.6/ssh2
running build_ext
building 'ssh2.pkey' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/ssh2
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilibssh2/include -I/app/.heroku/python/include/python3.6m -c ssh2/pkey.c -o build/temp.linux-x86_64-3.6/ssh2/pkey.o -O3
ssh2/pkey.c:527:21: fatal error: libssh2.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xqi26x3e/ssh2-python/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-yn7ewtm4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-xqi26x3e/ssh2-python/
! Push rejected, failed to compile Python app.
! Push failed
It seems to install a lot of other dependencies, which is fine. But it somehow fails to find libssh2.h.
What can I do about that?

Categories

Resources