Exiftools not installing on Heroku - python

I am trying to deploy my first project on Heroku and having an issue trying to install Exiftools on Heroku. My site is highly dependent on using ExifField within my models to get image information from pictures which is then displayed within my Django Admin to be edited etc. This all works fine locally in development.
Exiffield relies on Exiftool.exe to work, so I have to install a buildpack to Heroku which I have done, but it fails to see it during release when pushing to Heroku via CLI. All Django modules have installed OK.
I have added Procfile , requirements, runtime and everything seems to go OK, it even states it's intalled Exiftool but fails on release. Log below. Any help would be greatly appreciated.
I was thinking it was issue with Procfile but it seems correct.
release: python manage.py migrate
web: gunicorn blog.wsgi
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 375 bytes | 375.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote: 1. heroku/python
remote: 2. https://github.com/benalavi/buildpack-exiftool
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: ! Python has released a security update! Please consider upgrading to python-3.9.10
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.9.0
remote: -----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: -----> Skipping Django collectstatic since the env var DISABLE_COLLECTSTATIC is set.
remote: -----> exiftool app detected
remote: -----> Installing exiftool-9.40
remote: Setting PATH
remote: -----> Discovering process types
remote: Procfile declares types -> release, web
remote:
remote: -----> Compressing...
remote: Done: 80.4M
remote: -----> Launching...
remote: ! Release command declared: this new release will not be available until the command succeeds.
remote: Released v37
remote: https://********.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
remote: Running release command...
remote:
remote: SystemCheckError: System check identified some issues:
remote:
remote: ERRORS:
remote: myblog.Photo.exif: (exiffield.E001) `exiftool` not found.
remote: HINT: Please install `exiftool.`
remote: Waiting for release... failed.
To https://git.heroku.com/******.git
7281f6e..bf1bc47 master -> master

Related

ERROR: Invalid requirement: 'asgiref 3.5.2'

I am new to heroku and I wanted to deploy a simple app, when i push to heroku it is given me the error below. I check online unfortunately I dont find the right answer to it.
ERROR GIVEN
Enumerating objects: 73, done.
Counting objects: 100% (73/73), done.
Delta compression using up to 4 threads
Compressing objects: 100% (71/71), done.
Writing objects: 100% (73/73), 24.58 KiB | 719.00 KiB/s, done.
Total 73 (delta 11), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the buildpack default: python-3.10.4
remote: To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.10.4
remote: -----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: ERROR: Invalid requirement: 'asgiref 3.5.2' (from line 1 of /tmp/build_44a6c2b3/requirements.txt)
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to olakaymytodo.
remote:
To https://git.heroku.com/olakaymytodo.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/olakaymytodo.git'
I don't know waht have done wrong that make that show up my requirements.txt file is as follow
requirements.txt file
asgiref 3.5.2
Django 4.0.4
django-environ 0.8.1
environ 1.0
gunicorn 20.1.0
Pillow 9.1.1
pip 22.0.4
psycopg2 2.9.3
setuptools 62.1.0
sqlparse 0.4.2
tzdata 2022.1
wheel 0.37.1
is it the asgiref version?
I have search online but dont get a right answer to it. I hope someone here can help.
requirement.txt should be like this,
Try it,
asgiref==3.5.2
Django==4.0.4
django-environ==0.8.1
environ==1.0
gunicorn==20.1.0
Pillow==9.1.1
pip==22.0.4
psycopg2==2.9.3
setuptools==62.1.0
sqlparse==0.4.2
tzdata==2022.1
wheel==0.37.1

Heroku Django - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

I have recently deploy a new version of my web app to production in Heroku using their git commands, rather than through their UI using the GitHub connection. Ever since, I have started to get the following error:
Error:
2022-04-25T06:19:06.351920+00:00 heroku[web.1]: Starting process with command `gunicorn -b 0.0.0.0:57903 app.wsgi --log-file -`
2022-04-25T06:20:06.803913+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-04-25T06:20:07.621791+00:00 heroku[web.1]: State changed from starting to crashed
2022-04-25T06:20:07.025631+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-04-25T06:20:07.541144+00:00 heroku[web.1]: Process exited with status 137
Now I'm not saying this is the cause but when I initially deployed the code, my website worked for around a day or two before this appeared. I have being trying to add ports to the procfile as people are suggesting but nothing seems to be working and I have never needed to do that in the past. It neither works with or without the -b tag.
Procfile:
release: ./release-tasks.sh
web: gunicorn -b 0.0.0.0:$PORT card_companion_v2.wsgi --log-file -
worker: python manage.py process_tasks
wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings.development')
application = get_wsgi_application()
I am using tailwind so node.js is involved, so the buildpacks I am using are: heroku/nodejs, and heroku/python in that order.
Please let me know if you need anymore information.
Build Logs:
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote: 1. heroku/nodejs
remote: 2. heroku/python
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.14.2...
remote: Using default npm version: 8.5.0
remote:
remote: -----> Restoring cache
remote: Loading 1 from cacheDirectories (package.json):
remote: - theme/static_src/node_modules
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json)
remote:
remote: > app#1.0.0 postinstall
remote: > cd theme/static_src && npm install
remote:
remote:
remote: up to date, audited 463 packages in 1s
remote:
remote: 67 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: 7 vulnerabilities (1 moderate, 5 high, 1 critical)
remote:
remote: To address issues that do not require attention, run:
remote: npm audit fix
remote:
remote: To address all issues (including breaking changes), run:
remote: npm audit fix --force
remote:
remote: Run `npm audit` for details.
remote:
remote: up to date, audited 1 package in 2s
remote:
remote: found 0 vulnerabilities
remote:
remote: -----> Build
remote:
remote: -----> Caching build
remote: Saving 1 cacheDirectories (package.json):
remote: - theme/static_src/node_modules
remote:
remote: -----> Pruning devDependencies
remote:
remote: up to date, audited 1 package in 202ms
remote:
remote: found 0 vulnerabilities
remote:
remote: -----> Build succeeded!
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.10.4
remote: -----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: -----> $ python manage.py collectstatic --noinput
remote: > theme#3.0.0 build
remote: > npm run build:clean && npm run build:tailwind
remote: > theme#3.0.0 build:clean
remote: > rimraf ../static/css/dist
remote: > theme#3.0.0 build:tailwind
remote: > cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify
remote: Done in 1010ms.
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> release, web, worker
remote:
remote: -----> Compressing...
remote: Done: 205.2M
remote: -----> Launching...
remote: ! Release command declared: this new release will not be available until the command succeeds.
remote: Released v116
remote: https://app.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
remote: Running release command...
remote:
remote: Waiting for release........... done.

Why is Tesseract's .traineddata file not showing in heroku despite being uploaded and extracted succesfully?

I am trying to deploy an OCR app via heroku with Tesseract. wgetting the .traineddata files cause error, so I decided to compress them in a .tar.gz file and upload them in a custom buildpack from which the app builds. However, only the default eng.traineddata file is present, and the other .traineddata files are somehow getting deleted. The build log shows the files are extracted successfully. Pasting the build log below:
Counting objects: 1, done.
Writing objects: 100% (1/1), 183 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: Using supported version of Python 3.6 (python-3.6.6)
remote: -----> Installing requirements with pip
remote:
remote: -----> detect app detected
remote: Unpacking Tesseract-OCR binaries
remote: ./
remote: ./bin/
remote: ./bin/tesseract
remote: ./share/
remote: ./share/tessdata/
remote: ./share/tessdata/eng.traineddata
remote: ./lib/
remote: ./lib/libtesseract.so.4
remote: ./lib/liblept.so.5
remote: ./lib/libpng12.so.0
remote: ./lib/libgif.so.7
remote: Getting Tesseract-OCR training data
remote: eng.traineddata
remote: ben.traineddata
remote: eng training data
remote: ben training data
remote: traineddata files loaded
remote: ben.traineddata
remote: eng.traineddata
remote: Building runtime environment for Tesseract-OCR
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 73.7M
remote: -----> Launching...
remote: Released v24
remote: https://brocr.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/brocr.git
c7866b8..961e948 master -> master
Here is the output for ls -as command in the $TESSDATA_PREFIX directory:
~$ ls -as $TESSDATA_PREFIX
total 22928
4 . 4 .. 22920 eng.traineddata
Here is the compile script for the custom buildpack.
Am I missing something?

Python(Django) giving error while pushing on heroku

I am new to heroku as well as python (Django). i have made an app in django and want to push on heroku. but on git push heroku master it giving me this error.
Writing objects: 100% (245/245), 10.37 MiB | 110.00 KiB/s, done.
Total 245 (delta 35), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing Python-2.7.13
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: /app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda
all: line 5: /app/.heroku/python/bin/pip: No such file or directory
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy....
remote:
remote: ! Push rejected to djangoshopnror.
remote:
To https://git.heroku.com/djangoshopnror.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to
'https://git.heroku.com/djangoshopnror.git'
i have requirements.txt file and runtime.txt file.
runtime.txt look like this
Python-2.7.13
and requirements.txt look like this
BestBuyAPI==0.0.51
dj-database-url==0.4.2
Django==1.9
django-cors-headers==2.0.2
djangorestframework==3.6.2
djangorestframework-jwt==1.10.0
ebaysdk==2.1.4
gunicorn==19.7.1
lxml==3.7.3
psycopg2==2.7.1
PyJWT==1.5.0
pytz==2017.2
requests==2.7.0
virtualenv==15.1.0
wapy==1.0.0
whitenoise==3.3.0
one weired thing is when i change runtime.txt with python version 3.5.x it works. but due to some reasons i have to use python 2.7.x .
can anyone have answer about this. any suggestion or help will be highly appriciated.

Python and Node.js on Heroku

I have started to make a Node server which runs on Heroku. It was working fine until I tried to use the (unofficial) Duolingo API. I wrote the following Python script to connect to the API:
import duolingo
import simplejson as json
lingo = duolingo.Duolingo('harleyrowland')
print json.dumps(lingo.get_user_info())
and my Node server uses it using the following commands:
var python = require('python-shell');
module.exports = {
getData: function(callback){
python.run('duoScript.py', function (err, results) {
console.log(err);
console.log(results);
var res = JSON.parse(results);
var language = res.language_data.es.language_string;
var streak = res.language_data.es.streak;
var level = res.language_data.es.level;
var levelPerecentage = res.language_data.es.level_percent;
var fluency = res.language_data.es.fluency_score;
var nextLesson = res.language_data.es.next_lesson.skill_title;
return callback({language, streak, level, levelPerecentage, fluency, nextLesson});
});
}
}
which all works totally fine locally.
When I pushed this to Heroku, the code didn't work and I started to get the following error in the Heroku logs:
{ [Error: ImportError: No module named duolingo]
2016-10-06T00:02:32.133315+00:00 app[web.1]: traceback: 'Traceback (most recent call last):\n File "duoScript.py", line 1, in <module>\n import duolingo\nImportError: No module named duolingo\n',
executable: 'python',
options: null,
script: 'duoScript.py',
args: null,
exitCode: 1
}
Because of this, I went on the Heroku API and found that I needed to add a requirements.txt file. So I did:
duolingo-api==0.3
simplejson==3.8.2
which still didn't work. I then found this answer and added a .buildpacks file:
https://github.com/heroku/heroku-buildpack-python.git
https://github.com/heroku/heroku-buildpack-nodejs.git
and I still get the same error.
Any idea what is causing this error?
Update 1
Thought I would show my Procfile too incase this was the problem:
web: node index.js
pipinstall: pip install -r requirements.txt
Update 2
Output of git push heroku master without pipinstall:
$ git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 288 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 5.9.1
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Downloading and installing node 5.9.1...
remote: Using default npm version: 3.7.3
remote:
remote: -----> Restoring cache
remote: Loading 2 from cacheDirectories (default):
remote: - node_modules
remote: - bower_components (not cached - skipping)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: -----> Caching build
remote: Clearing previous node cache
remote: Saving 2 cacheDirectories (default):
remote: - node_modules
remote: - bower_components (nothing to cache)
remote:
remote: -----> Build succeeded!
remote: ├── ejs#2.4.1 extraneous
remote: ├── emailjs#1.0.8 extraneous
remote: ├── express#4.13.3
remote: ├── http-status#0.2.3
remote: ├── nodemailer#1.4.0
remote: ├── nodemailer-smtp-transport#1.0.4
remote: ├── python-shell#0.4.0
remote: └── xoauth2#1.2.0
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 13M
remote: -----> Launching...
remote: Released v25
remote: https://arcane-anchorage-33274.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
Try to remove the deprecated heroku-buildpack-multi and use the Heroku buildpacks command:
$ heroku buildpacks:add --index 1 heroku/nodejs
$ heroku buildpacks:add --index 2 heroku/python
$ heroku buildpacks
=== foobar Buildpack URLs
1. heroku/nodejs
2. heroku/python
From the docs:
The buildpack for the primary language of your app should always be the last buildpack in the list. This ensures that defaults for that primary language are applied instead of those for another language, and allows Heroku to correctly detect the primary language of your app.
Maybe useful for some: if you are deploying via GitHub (and not via the Heroku CLI), you can add buildpacks for other languages in your Heroku dashboard under the Settings tab .

Categories

Resources