0π
I tested the same steps on windows 10 and everything pass with flying colors and I was able to deploy to heroku.
It seems like this might be MAC OS Mojave specific.
MacOS Mojave 10.14.6
was the version I had an issue with
Solution for me was to deploy through windows 10 or downgrade to a older Mac OS such as High Sierra.
42π
I have tried several solutions, none worked except simplest solution:
pip3 install psycopg2==2.7.5
this command worked perfectly (seems like a problem with a version)
- [Django]-How to add verbose_name to forms
- [Django]-How can I avoid "Using selector: EpollSelector" log message in Django?
- [Django]-How to display all model fields with ModelSerializer?
32π
To install heroku in django the command line django-heroku
changed to
pip install django-on-heroku
- [Django]-Django delete FileField
- [Django]-Disable migrations when running unit tests in Django 1.7
- [Django]-Django abstract models versus regular inheritance
13π
For MacOS users
After trying all the above methods (which did not work for me on MacOS 10.14), that one worked :
Install openssl with
brew install openssl
if you donβt have it already.
add openssl path to LIBRARY_PATH :
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
install psycopg2 with pip
pip3 install psycopg2
I was searching and this finally worked for me.
- [Django]-Laravel's dd() equivalent in django
- [Django]-Removing 'Sites' from Django admin page
- [Django]-What is the best way to upload files in a modern browser
6π
do this and it will work
brew install postgresql
pip3 install psycopg2
pip install django-heroku
- [Django]-No URL to redirect to. Either provide a url or define a get_absolute_url method on the Model
- [Django]-Django ModelForm override widget
- [Django]-How does django handle multiple memcached servers?
4π
I have had the same issue and kept wondering why Heroku had not updated the package django-heroku
package to fix this. However we should not expect updates to fix this. The django-heroku repo has been achieved on github. https://github.com/heroku/django-heroku
.
Closer look at https://github.com/heroku/django-heroku/blob/master/setup.py
will show you they listed psycopg2
as a requirement. Hence why it tries to install on your computer.
Solution to this.
1. Remove django-heroku package from your requirements.
2. Remove django-heroku settings from settings.py
3. Set STATIC_ROOT.
4. Add your heroku url to ALLOWED_HOSTS.
Django-heroku
is no longer needed to host Django applications on heroku. I have tested the above with an application running on DJango 2.2.
- [Django]-Include CSS and Javascript in my django template
- [Django]-Redirect to Next after login in Django
- [Django]-WARNING Not Found: /favicon.ico in Django
3π
Recently ran into the issue .
What helped me is pip3 install psycopg2==2.8.3 and later on pip3 install django-heroku
- [Django]-Django test VS pytest
- [Django]-Django Reverse Accessor Clashes
- [Django]-Django-admin: Add extra row with totals
2π
From docs
For most operating systems, the quickest way to install Psycopg is using the wheel package available on PyPI:
$ pip install psycopg2-binary
This will install a pre-compiled binary version of the module which does not require the build or runtime prerequisites.
you should get such a response
Collecting psycopg2-binary
Downloading psycopg2_binary-2.8.6-cp38-cp38-manylinux1_x86_64.whl (3.0 MB)
|ββββββββββββββββββββββββββββββββ| 3.0 MB 62 kB/s
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.8.6
- [Django]-Django template tag to truncate text
- [Django]-Determine complete Django url configuration
- [Django]-How can I set a DateField format in django from the model?
1π
OS: MacOS Mojave 10.14.4
virtualenv: python3.6
Iβm not using heroku but was getting the same error and this is what fixed it for me:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
after that you should be able to install via pip:
(venv) MacBook-Pro:testing_django user$ pip install psycopg2
(venv) MacBook-Pro:testing_django user$ pip freeze
Django==2.2.4
psycopg2==2.8.3
pytz==2019.2
sqlparse==0.3.0
from: https://github.com/python-pillow/Pillow/issues/3438#issuecomment-435169249
- [Django]-How can I tell the Django ORM to reverse the order of query results?
- [Django]-How to get the app a Django model is from?
- [Django]-Switching from MySQL to Cassandra β Pros/Cons?
1π
I had the same issue for a while then this helped me:
brew install openssl
Add openssl
path to LIBRARY_PATH
:
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
Install psycopg2
with pip:
pip3 install psycopg2
then finally:
pip3 install django-heroku
- [Django]-Django models: default value for column
- [Django]-Django get the static files URL in view
- [Django]-How to get the ID of a just created record in Django?
1π
In linux,try
sudo apt install libpq-dev
pip install django-heroku
I solved my issue using these commands
if it is not working,try
sudo apt install django-on-heroku
- [Django]-ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)
- [Django]-Django templates: verbose version of a choice
- [Django]-React routing and django url conflict
1π
pip install django-on-heroku
changed psycopg2 to psycopg2-binary so it works and is installable!
- [Django]-Django: implementing JOIN using Django ORM?
- [Django]-What is the best way to migrate data in django
- [Django]-Programmatically create a django group with permissions
0π
You will need to install postgres db, postgres client and libpq-dev via os commands
Then you can install below in python environ
pip install psycopg2
For more details look at http://initd.org/psycopg/docs/install.html
- [Django]-How to make Django's devserver public ? Is it generally possible?
- [Django]-Loop backwards using django template
- [Django]-What is the equivalent of "none" in django templates?
0π
Update: Oct.12.2021
Same solution as @Artur offered but I had to change the version to
pip3 install psycopg2==2.9
- [Django]-Celery : Execute task after a specific time gap
- [Django]-Multiple Models in a single django ModelForm?
- [Django]-Exclude fields in Django admin for users other than superuser
0π
You can use this brew install postgresql to install packages with the correct wheel file. When a venv is activated, sometimes you need to download the correct wheel file to install certain packages. This installation uses setup.py install instead making it easy for the virtual environment to install the desired package using the pip3 installation. Another common package that requires this installation is scikit-learn.
brew install postgresql
pip3 install psycopg2
pip3 install django-heroku
- [Django]-Django Queryset only() and defer()
- [Django]-Adding REST to Django
- [Django]-How do I check for last loop iteration in Django template?
0π
In my case, I was missing sudo apt-get install python3-dev
. I already had psycopg2-2.9.3 but this then enabled pip install django-heroku
to compile correctly.
- [Django]-Django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. (django 2.0.1)(Python 3.6)
- [Django]-Difference between os.path.dirname(os.path.abspath(__file__)) and os.path.dirname(__file__)
- [Django]-Automatically create an admin user when running Django's ./manage.py syncdb
0π
pip install psycopg2-binary
pip install django-on-heroku
Why?
psycopg2
requires the Postgres
utility file, named pg_config
. The pg_config
utility prints configuration parameters of the currently installed version of PostgreSQL. If it is missing since you donβt like to install Postgres
locally, the solution is using psycopg2-binary
. The django-heroku
module requires psycopg2
and has been archived and no maintenance is available for it. A forked, django-on-heroku
, has been created which uses psycopg2-binary
.
- [Django]-Select DISTINCT individual columns in django?
- [Django]-Customize/remove Django select box blank option
- [Django]-How to resolve "django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: foo" in Django 1.7?