pythonのDjangoで
git push heroku master
とやった時,以下のエラーが...
Counting objects: 31, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (31/31), 5.57 KiB | 1.85 MiB/s, done.
Total 31 (delta 5), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.5
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: Collecting dj-database-url==0.5.0 (from -r /tmp/build_974b1a0774884d140e71026c0a3f1b43/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
remote: Collecting Django==1.11 (from -r /tmp/build_974b1a0774884d140e71026c0a3f1b43/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/47/a6/078ebcbd49b19e22fd560a2348cfc5cec9e5dcfe3c4fad8e64c9865135bb/Django-1.11-py2.py3-none-any.whl (6.9MB)
remote: Collecting gunicorn==19.8.1 (from -r /tmp/build_974b1a0774884d140e71026c0a3f1b43/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/55/cb/09fe80bddf30be86abfc06ccb1154f97d6c64bb87111de066a5fc9ccb937/gunicorn-19.8.1-py2.py3-none-any.whl (112kB)
remote: Collecting pytz==2018.4 (from -r /tmp/build_974b1a0774884d140e71026c0a3f1b43/requirements.txt (line 4))
remote: Downloading https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl (510kB)
remote: Collecting whitenoise==3.3.1 (from -r /tmp/build_974b1a0774884d140e71026c0a3f1b43/requirements.txt (line 5))
remote: Downloading https://files.pythonhosted.org/packages/0c/58/0f309a821b9161d0e3a73336a187d1541c2127aff7fdf3bf7293f9979d1d/whitenoise-3.3.1-py2.py3-none-any.whl
remote: Collecting psycopg2==2.5.4 (from -r /tmp/build_974b1a0774884d140e71026c0a3f1b43/requirements.txt (line 6))
remote: Downloading https://files.pythonhosted.org/packages/63/c3/802668cb3cfc2880c2a8364623e7105a0257724a2612bb66ec733aaddb8c/psycopg2-2.5.4.tar.gz (682kB)
remote: Complete output from command python setup.py egg_info:
remote: running egg_info
remote: creating pip-egg-info/psycopg2.egg-info
remote: writing pip-egg-info/psycopg2.egg-info/PKG-INFO
remote: writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
remote: writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
remote: writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
remote: Error: could not determine PostgreSQL version from '10.4'
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e7m3xfsy/psycopg2/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to (アプリ名).
remote:
To https://git.heroku.com/first-django2.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/(アプリ名).git'
注目するのは以下の部分
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e7m3xfsy/psycopg2/
psycopg2内に書かれたpython setup.py egg_infoというコマンドが実行できないというお話.
結論としてはpsycopg2をアップグレードして,それをrequirement.txtに反映してからpushすれば解決した.
pip install --upgrade psycopg2
してから
pip freeze
でpsycopg2のバージョンを確認し,それをrequirement.txtに反映(書き換え)
git add -A
git commit -m "update psycopg2"
git push heroku master
これで回りました