I am trying to install poppler on my Heroku server because I am using pdf2image as a python package. However, I can't just run brew install poppler like I did on my Mac.
I have tried to add some heroku buildpacks off the internet but with no luck. Anytime pdf2image runs I get this error.
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
Is there something I can do on the command line to get poppler installed while keeping heroku/python as my buildpack?
You can install APT packages with an experimental function on Heroku
Steps:
Add the buildpack to Heroku.
heroku buildpacks:add --index 1 heroku-community/apt
Make a file named Aptfile in your project folder and write poppler-utils inside.
Commit and push.
Is there something I can do on the command line to get poppler installed while keeping heroku/python as my buildpack?
Heroku lets you run multiple buildpacks. I haven't tried this buildpack, but I'd recommend adding this buildpack to your existing app:
heroku buildpacks:set heroku/python
heroku buildpacks:add --index 1 https://github.com/survantjames/heroku-buildpack-poppler.git
Then redeploy your application.
Related
So I have a Django web app running on Heroku. I recently pushed an update where I added some API functionality via the Django Rest Framework. I installed this via pip. Now my Heroku app crashes. I assume I somehow need to install this dependency on Heroku? Here is the error message:
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I tried entering the Heroku CLI and typing pip install djangorestframework but and running Heroku restart but it still crashes.
Edit: some more details, I tried installing this dependency on my machine via git clone in addition to pip. When I pushed this code to Heroku, in the command line I see cannot stat '/tmp/build_5917e4123a7c/requirements.txt': No such file or directory
Edit2: Just to keep this post updated, I'm not trying to add a requirements.txt file to my project with this dependency in it. The file is in the root directory and the only text in it is:
djangorestframework==3.11.0
Edit3: I fixed it. See my answer
So I installed my dependency with pip install djangorestframework but I needed to use pipenv install djangorestframework. The Pipfile therefore never had this dependency added so Heroku wasn't able to see it since it seems Heroku checks the Pipfile. I guess requirements.txt is the old deprecated way to do this?
I want to install gettext in Heroku. I have added: https://github.com/lexifdev/heroku-buildpack-gettext.git into the buildpacks section of my app. However, when I run
heroku run python manage.py compilemessages -l en
I get the error message: CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.
Had the same problem my friend. Here's how I fixed it:
From the heroku dashboard, add the following buildpack: https://github.com/grauwoelfchen/heroku-buildpack-gettext.git
On your next deployment to heroku (e.g. a git push), it and any other buildpacks you have will be built and installed and all should work.
Here is how I did it
type the following commands
heroku buildpacks: add https://github.com/grauwoelfchen/heroku-buildpack-gettext
git push heroku master
Now, the gettext will be added
Good day.
I'm a newbie to Django and I have a slight confusion:
When deploying my Django app, do I need to deploy it with all the Python 'come-with' modules, or the hosts already have them installed.
Also, I installed PIL for image manipulation. Would they also have it installed or i have to find a way to install it on their servers. Thanks in advance
do I need to deploy it with all the Python 'come-with' modules
Never do that. It might conflict with the dependencies on the server. Instead issue the following command to create a dependency file (requirements.txt).
pip freeze > requirements.txt (issue this command where manage.py is located)
On the server create a new virtual environment. Now copy django project to the server (you can do this using git clone or just plain old Filezilla). Activate virtual environment. Then change you current working directory to the where manage.py is located. to install all the dependencies issue the following command.
pip install -r requirements.txt
This will install the required dependencies on on server.
I tried below 2 methods to install django_twilio module on Heroku
1) Ran 'heroku run pip install django-twilio'
2) Added 'twilio==3.6.3' to requirements.txt and start the server on heroku.
When I run 'heroku run pip freeze' I can see the twilio entry. But when I go into python and run 'import django_twilio' I get a module not found error.
Please suggest how to fix this on heroku. Same steps worked fine on my local machine.
You didn't add the proper requirement, you only installed the twilio library. Your requirements.txt should include the following line:
django-twilio==0.4
Which will include all the other dependencies you'll need. The full pip freeze, after installing django-twilio looks like this:
Django==1.5.5
django-twilio==0.4
httplib2==0.8
six==1.4.1
twilio==3.6.3
unittest2==0.5.1
As a rule of thumb, always run pip freeze > requirements.txt before pushing an update to Heroku (assuming new dependencies were installed), to make sure you have a complete snapshot of your environment.
Im attempting to deploy a Django app using Heroku.
When I first ran
$ git push heroku master
My original requirements.txt had outdated dependencies and Django failed to deploy. After I edited my dependencies and attempted to deploy I noticed that Heroku is still attempting to install dependencies that I erased. Am I doing something wrong here?