'Django 'pip install django-heroku'(psycopg2) error is blocking deployment to Heroku
I am setting up a new Django project to deploy on Heroku, however when I am following the Django Heroku deployment guide I come across an error during 'pip install django-heroku'.
I am running on:
OS: MacOS Mojave 10.14.6
virtualenv: python3
pip freeze output:
(env) MacBook-Pro:testing_django sudoxx2$ pip freeze
dj-database-url==0.5.0
Django==2.2.3
gunicorn==19.9.0
psycopg2-binary==2.8.3
pytz==2019.1
sqlparse==0.3.0
whitenoise==4.1.3
Here is the error output after executing the pip install django-heroku
command:
(env) MacBook-Pro:testing_django sudoxx2$ pip install psycopg2-binary
Collecting psycopg2-binary
Using cached https://files.pythonhosted.org/packages/ee/ed/2772267467ba5c21a73d37149da0b49a4343c6646d501dbb1450b492d40a/psycopg2_binary-2.8.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.8.3
(env) MacBook-Pro:testing_django sudoxx2$ pip install django-heroku
Collecting django-heroku
Using cached https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
Collecting psycopg2 (from django-heroku)
Using cached https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz
Requirement already satisfied: whitenoise in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (4.1.3)
Requirement already satisfied: django in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (2.2.3)
Requirement already satisfied: dj-database-url>=0.5.0 in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (0.5.0)
Requirement already satisfied: sqlparse in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (0.3.0)
Requirement already satisfied: pytz in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (2019.1)
Installing collected packages: psycopg2, django-heroku
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2
cwd: /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/psycopg
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110004 -DHAVE_LO64=1 -I/Users/sudoxx2/Documents/github/delete_copy/env/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/11.4/include -I/usr/local/Cellar/postgresql/11.4/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:10: warning: non-portable path to file '<String.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include <string.h>
^~~~~~~~~~
<String.h>
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:
/usr/local/include/string.h:25:10: fatal error: 'plist/Node.h' file not found
#include <plist/Node.h>
^~~~~~~~~~~~~~
1 warning and 1 error generated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2 Check the logs for full command output.
(env) MacBook-Pro:testing_django sudoxx2$ pip install psycopg2-binary
Collecting psycopg2-binary
Using cached https://files.pythonhosted.org/packages/ee/ed/2772267467ba5c21a73d37149da0b49a4343c6646d501dbb1450b492d40a/psycopg2_binary-2.8.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.8.3
(env) MacBook-Pro:testing_django sudoxx2$ pip install django-heroku
Collecting django-heroku
Using cached https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
Collecting psycopg2 (from django-heroku)
Using cached https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz
Requirement already satisfied: whitenoise in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (4.1.3)
Requirement already satisfied: django in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (2.2.3)
Requirement already satisfied: dj-database-url>=0.5.0 in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (0.5.0)
Requirement already satisfied: sqlparse in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (0.3.0)
Requirement already satisfied: pytz in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (2019.1)
Installing collected packages: psycopg2, django-heroku
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2
cwd: /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/psycopg
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110004 -DHAVE_LO64=1 -I/Users/sudoxx2/Documents/github/delete_copy/env/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/11.4/include -I/usr/local/Cellar/postgresql/11.4/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:10: warning: non-portable path to file '<String.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include <string.h>
^~~~~~~~~~
<String.h>
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:
/usr/local/include/string.h:25:10: fatal error: 'plist/Node.h' file not found
#include <plist/Node.h>
^~~~~~~~~~~~~~
1 warning and 1 error generated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2 Check the logs for full command output.(env) MacBook-Pro:testing_django sudoxx2$ pip install psycopg2-binary
Collecting psycopg2-binary
Using cached https://files.pythonhosted.org/packages/ee/ed/2772267467ba5c21a73d37149da0b49a4343c6646d501dbb1450b492d40a/psycopg2_binary-2.8.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.8.3
(env) MacBook-Pro:testing_django sudoxx2$ pip install django-heroku
Collecting django-heroku
Using cached https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
Collecting psycopg2 (from django-heroku)
Using cached https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz
Requirement already satisfied: whitenoise in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (4.1.3)
Requirement already satisfied: django in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (2.2.3)
Requirement already satisfied: dj-database-url>=0.5.0 in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (0.5.0)
Requirement already satisfied: sqlparse in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (0.3.0)
Requirement already satisfied: pytz in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (2019.1)
Installing collected packages: psycopg2, django-heroku
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2
cwd: /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/psycopg
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110004 -DHAVE_LO64=1 -I/Users/sudoxx2/Documents/github/delete_copy/env/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/11.4/include -I/usr/local/Cellar/postgresql/11.4/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:10: warning: non-portable path to file '<String.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include <string.h>
^~~~~~~~~~
<String.h>
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:
/usr/local/include/string.h:25:10: fatal error: 'plist/Node.h' file not found
#include <plist/Node.h>
^~~~~~~~~~~~~~
1 warning and 1 error generated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2 Check the logs for full command output.(env) MacBook-Pro:testing_django sudoxx2$ pip install psycopg2-binary
Collecting psycopg2-binary
Using cached https://files.pythonhosted.org/packages/ee/ed/2772267467ba5c21a73d37149da0b49a4343c6646d501dbb1450b492d40a/psycopg2_binary-2.8.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.8.3
(env) MacBook-Pro:testing_django sudoxx2$ pip install django-heroku
Collecting django-heroku
Using cached https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
Collecting psycopg2 (from django-heroku)
Using cached https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz
Requirement already satisfied: whitenoise in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (4.1.3)
Requirement already satisfied: django in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (2.2.3)
Requirement already satisfied: dj-database-url>=0.5.0 in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django-heroku) (0.5.0)
Requirement already satisfied: sqlparse in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (0.3.0)
Requirement already satisfied: pytz in /Users/sudoxx2/Documents/github/delete_copy/env/lib/python3.7/site-packages (from django->django-heroku) (2019.1)
Installing collected packages: psycopg2, django-heroku
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2
cwd: /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/psycopg
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110004 -DHAVE_LO64=1 -I/Users/sudoxx2/Documents/github/delete_copy/env/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/11.4/include -I/usr/local/Cellar/postgresql/11.4/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:10: warning: non-portable path to file '<String.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include <string.h>
^~~~~~~~~~
<String.h>
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:30:
/usr/local/include/string.h:25:10: fatal error: 'plist/Node.h' file not found
#include <plist/Node.h>
^~~~~~~~~~~~~~
1 warning and 1 error generated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/sudoxx2/Documents/github/delete_copy/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-install-cq6yuehb/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/s84v7k6d1dx_m_6qbd1wfbz80000gp/T/pip-record-tyidyv7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sudoxx2/Documents/github/delete_copy/env/include/site/python3.7/psycopg2 Check the logs for full command output.
I have tried pip install psycopg2-binary
but no luck.
Made a new project to test and have same error.
Any help would be awesome.
UPDATE 7/31/2019
I tested on windows 10 and everything pass with flying colors and was able to deploy to heroku. It seems like this might be Mojave OS specific.
Solution 1:[1]
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.
Solution 2:[2]
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)
Solution 3:[3]
To install heroku in django the command line django-heroku
changed to
pip install django-on-heroku
Solution 4:[4]
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.
Solution 5:[5]
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.
Solution 6:[6]
do this and it will work
brew install postgresql
pip3 install psycopg2
pip install django-heroku
Solution 7:[7]
Recently ran into the issue . What helped me is pip3 install psycopg2==2.8.3 and later on pip3 install django-heroku
Solution 8:[8]
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
Solution 9:[9]
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
Solution 10:[10]
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
Solution 11:[11]
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
Solution 12:[12]
pip install django-on-heroku
changed psycopg2 to psycopg2-binary so it works and is installable!
Solution 13:[13]
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
Solution 14:[14]
Update: Oct.12.2021
Same solution as @Artur offered but I had to change the version to
pip3 install psycopg2==2.9
Solution 15:[15]
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
Solution 16:[16]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow