Heroku: запустить установку Apt перед PIP - PullRequest
0 голосов
/ 06 октября 2019

У меня есть приложение Heroku с зависимостью от tesserocr. Я заметил, что всякий раз, когда я нажимаю на код, происходит установка PIP, за которой следуют установки apt.

Проблема с порядком состоит в том, что tesserocr не удается установить, так как tesseract и связанные с ним зависимости не найдены.

Итакмой вопрос: можно ли принудительно запустить установку APT перед установкой PIP?

Ошибка:

Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote:        Collecting tesserocr (from -r /tmp/build_c41a34f76dceeeec2270d516154516ad/requirements.txt (line 7))
remote:          Downloading https://files.pythonhosted.org/packages/97/14/2297039bd74baf2ce970549d4fec383fb6e435d0a48f79813f195834937f/tesserocr-2.4.1.tar.gz (56kB)
remote:        Installing collected packages: tesserocr
remote:          Running setup.py install for tesserocr: started
remote:            Running setup.py install for tesserocr: finished with status 'error'
remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-h68_4bu9/tesserocr/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-nunngljc-record/install-record.txt --single-version-externally-managed --compile:
remote:            /tmp/pip-build-h68_4bu9/tesserocr/setup.py:152: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
remote:              _LOGGER.warn('pkg-config failed to find tesseract/lept libraries: {}'.format(e))
remote:            pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path.\nPerhaps you should add the directory containing `tesseract.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'tesseract' found\n"
remote:            /tmp/pip-build-h68_4bu9/tesserocr/setup.py:134: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
remote:              _LOGGER.warn('Failed to extract tesseract version from executable: {}'.format(e))
remote:            Failed to extract tesseract version from executable: [Errno 2] No such file or directory: 'tesseract': 'tesseract'
remote:            Supporting tesseract v3.04.00
remote:            Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 50593792}}
remote:            /app/.heroku/python/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
remote:              warnings.warn(msg)
remote:            running install
remote:            running build
remote:            running build_ext
remote:            building 'tesserocr' extension
remote:            creating build
remote:            creating build/temp.linux-x86_64-3.7
remote:            gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.7m -c tesserocr.cpp -o build/temp.linux-x86_64-3.7/tesserocr.o
remote:            tesserocr.cpp:634:10: fatal error: leptonica/allheaders.h: No such file or directory
remote:             #include "leptonica/allheaders.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-h68_4bu9/tesserocr/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-nunngljc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-h68_4bu9/tesserocr/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
...