错误:无法从“10.3”确定 PostgreSQL 版本 - Heroku 上的 Django

Posted

技术标签:

【中文标题】错误:无法从“10.3”确定 PostgreSQL 版本 - Heroku 上的 Django【英文标题】:Error: could not determine PostgreSQL version from '10.3' - Django on Heroku 【发布时间】:2018-08-23 18:58:11 【问题描述】:

我试图从本地环境推送到 Heroku 大师。上一次提交没有新要求。但是,我收到一个错误,说系统无法从“10.3”确定 PostgreSQL 版本。

这是我的需求清单:

amqp==1.4.9
anyjson==0.3.3
appdirs==1.4.3
awscli==1.11.89
billiard==3.3.0.23
boto==2.46.1
botocore==1.5.52
celery==3.1.25
Collectfast==0.5.2
colorama==0.3.7
dj-database-url==0.4.2
Django==1.11.1
django-celery==3.2.1
django-recaptcha==1.3.0
django-redis-cache==1.7.1
django-storages==1.5.2
django-storages-redux==1.3.2
docutils==0.13.1
gunicorn==19.7.0
honcho==0.5.0
jmespath==0.9.2
kombu==3.0.37
olefile==0.44
packaging==16.8
Pillow==4.3.0
psycopg2==2.6.2
pyasn1==0.2.3
pyparsing==2.2.0
python-dateutil==2.6.0
pytz==2018.3
PyYAML==3.12
redis==2.10.5
reportlab==3.4.0
rsa==3.4.2
s3transfer==0.1.10
selenium==3.4.0
six==1.10.0
vine==1.1.4
virtualenv==15.1.0
virtualenvwrapper-win==1.2.1
whitenoise==3.3.0

以下是构建日志中的错误。

Collecting amqp==1.4.9 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 1))
         Downloading amqp-1.4.9-py2.py3-none-any.whl (51kB)
       Collecting anyjson==0.3.3 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 2))
         Downloading anyjson-0.3.3.tar.gz
       Collecting appdirs==1.4.3 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 3))
         Downloading appdirs-1.4.3-py2.py3-none-any.whl
       Collecting awscli==1.11.89 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 4))
         Downloading awscli-1.11.89-py2.py3-none-any.whl (1.2MB)
       Collecting billiard==3.3.0.23 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 5))
         Downloading billiard-3.3.0.23.tar.gz (151kB)
       Collecting boto==2.46.1 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 6))
         Downloading boto-2.46.1-py2.py3-none-any.whl (1.4MB)
       Collecting botocore==1.5.52 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 7))
         Downloading botocore-1.5.52-py2.py3-none-any.whl (3.5MB)
       Collecting celery==3.1.25 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 8))
         Downloading celery-3.1.25-py2.py3-none-any.whl (526kB)
       Collecting Collectfast==0.5.2 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 9))
         Downloading Collectfast-0.5.2-py3-none-any.whl
       Collecting colorama==0.3.7 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 10))
         Downloading colorama-0.3.7-py2.py3-none-any.whl
       Collecting dj-database-url==0.4.2 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 11))
         Downloading dj_database_url-0.4.2-py2.py3-none-any.whl
       Collecting Django==1.11.1 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 12))
         Downloading Django-1.11.1-py2.py3-none-any.whl (6.9MB)
       Collecting django-celery==3.2.1 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 13))
         Downloading django-celery-3.2.1.tar.gz (91kB)
       Collecting django-recaptcha==1.3.0 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 14))
         Downloading django-recaptcha-1.3.0.tar.gz
       Collecting django-redis-cache==1.7.1 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 15))
         Downloading django-redis-cache-1.7.1.tar.gz
       Collecting django-storages==1.5.2 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 16))
         Downloading django_storages-1.5.2-py2.py3-none-any.whl (51kB)
       Collecting django-storages-redux==1.3.2 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 17))
         Downloading django_storages_redux-1.3.2-py2.py3-none-any.whl (41kB)
       Collecting docutils==0.13.1 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 18))
         Downloading docutils-0.13.1-py3-none-any.whl (536kB)
       Collecting gunicorn==19.7.0 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 19))
         Downloading gunicorn-19.7.0-py2.py3-none-any.whl (112kB)
       Collecting honcho==0.5.0 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 20))
         Downloading honcho-0.5.0.tar.gz
       Collecting jmespath==0.9.2 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 21))
         Downloading jmespath-0.9.2-py2.py3-none-any.whl
       Collecting kombu==3.0.37 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 22))
         Downloading kombu-3.0.37-py2.py3-none-any.whl (240kB)
       Collecting olefile==0.44 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 23))
         Downloading olefile-0.44.zip (74kB)
       Collecting packaging==16.8 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 24))
         Downloading packaging-16.8-py2.py3-none-any.whl
       Collecting Pillow==4.3.0 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 25))
         Downloading Pillow-4.3.0-cp35-cp35m-manylinux1_x86_64.whl (5.8MB)
       Collecting psycopg2==2.6.2 (from -r /tmp/build_28bcf3a327daae7657433628289c1501/requirements.txt (line 26))
         Downloading psycopg2-2.6.2.tar.gz (376kB)
           Complete output from command python setup.py egg_info:
           running egg_info
           creating pip-egg-info/psycopg2.egg-info
           writing pip-egg-info/psycopg2.egg-info/PKG-INFO
           writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
           writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
           writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
           Error: could not determine PostgreSQL version from '10.3'

           ----------------------------------------
       Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-24iic71n/psycopg2/
 !     Push rejected, failed to compile Python app.
 !     Push failed

有人经历过这个吗?

【问题讨论】:

问题通过将psycopg2升级到requirements.txt文件中的2.7.1版本解决。 【参考方案1】:

OP的评论在psycopg/psycopg2 issue 594得到确认

pip install psycopg2 成功并安装2.7.3.1版本。 但我想要 2.6.1 版

问题已在 psycopg 2.7 中发布的#489 中得到修复。我们没有计划将修复程序向后移植到 2.6。

使用来自 Postgres 生产版本的 pg_config,而不是来自 10 beta 4。

见PR 504

【讨论】:

以上是关于错误:无法从“10.3”确定 PostgreSQL 版本 - Heroku 上的 Django的主要内容,如果未能解决你的问题,请参考以下文章

如何从 postgresql 10.3 中的这个多重连接查询中删除嵌套循环

The application server could not be contacted

如何从错误消息中确定 PostgreSQL 错误代码

华为云数据库 PostgreSQL 支持 10.3 ,高性能,新体验

iOS 10.3 APFS 不支持大部分的非英文字符解决方案

免安装PostgreSQL启动服务及创建数据库