nt95
nt95

Reputation: 595

Push to heroku fails

I am following this tutorial https://www.codementor.io/jamesezechukwu/how-to-deploy-django-app-on-heroku-dtsee04d4 for deploying my Django app to heroku. This is my first Django app:

Push rejected, failed to compile Python app.

I'm currently running python 3.7.0. this is set in my runtime.txt file: python-3.7.0

stack trace:

Enumerating objects: 11614, done.
Counting objects: 100% (11614/11614), done.
Delta compression using up to 4 threads
Compressing objects: 100% (8294/8294), done.
Writing objects: 100% (11614/11614), 42.09 MiB | 3.12 MiB/s, done.
Total 11614 (delta 2534), reused 8489 (delta 2166)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote:  !     Python has released a security update! Please consider upgrading to python-3.7.3
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.7.0
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip



remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-build-r7xse4_1/django-dbbackup/setup.py", line 59, in <module>
remote:                install_requires=get_requirements(),
remote:              File "/tmp/pip-build-r7xse4_1/django-dbbackup/setup.py", line 45, in get_requirements
remote:                import pysftp  # @UnusedImport
remote:              File "/app/.heroku/python/lib/python3.7/site-packages/pysftp.py", line 10, in <module>
remote:                import paramiko
remote:              File "/app/.heroku/python/lib/python3.7/site-packages/paramiko/__init__.py", line 30, in <module>
remote:                from paramiko.transport import SecurityOptions, Transport
remote:              File "/app/.heroku/python/lib/python3.7/site-packages/paramiko/transport.py", line 61, in <module>
remote:                from paramiko.sftp_client import SFTPClient
remote:              File "/app/.heroku/python/lib/python3.7/site-packages/paramiko/sftp_client.py", line 41, in <module>
remote:                from paramiko.sftp_file import SFTPFile
remote:              File "/app/.heroku/python/lib/python3.7/site-packages/paramiko/sftp_file.py", line 66
remote:                self._close(async=True)
remote:                                ^
remote:            SyntaxError: invalid syntax
remote:            
remote:            ----------------------------------------
remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r7xse4_1/django-dbbackup/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3pz1o34a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-r7xse4_1/django-dbbackup/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to {my_app}.
remote: 


 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/{my_app.git}'

the requirements txt file:

asn1crypto==0.24.0
astroid==1.4.9
bcrypt==3.1.4
boto==2.34.0
boto3==1.9.38
botocore==1.12.104
cffi==1.11.5
coverage==4.5.1
cryptography==2.3.1
dj-database-url==0.3.0
dj-static==0.0.6
Django==2.2.4
django-dbbackup==2.0.4
django-filter==0.8
django-jsonfield==0.9.13
django-markdown-deux==1.0.5
django-oauth-plus==2.2.8
django-oauth2-provider==0.2.6.1
django-sslify==0.2.5
django-toolbelt==0.0.1
djangorestframework==2.4.4
djangorestframework-oauth==1.0.1
docutils==0.14
ecdsa==0.13
eventlog==0.11.0
gunicorn==19.1.1
httplib2==0.9
idna==2.7
isort==4.3.9
jmespath==0.9.4
lazy-object-proxy==1.3.1
Markdown==2.5.2
markdown2==2.3.0
mccabe==0.6.1
mock==2.0.0
newrelic==2.44.0.36
numpy==1.17.0
oauth2==1.9.0.post1
pandas==0.25.0
paramiko==1.15.2
pbr==5.1.2
pgeocode==0.1.1
psycopg2==2.7.5
py-mini-racer==0.1.15
pyasn1==0.4.4
pycparser==2.18
pycrypto==2.6.1
pylint==1.6.5
PyNaCl==1.2.1
pysftp==0.2.8
pystache==0.5.4
python-dateutil==2.8.0
pytz==2018.4
requests==2.2.1
requests-toolbelt==0.8.0
rsa==3.4.2
s3transfer==0.1.13
shortuuid==0.4.0
six==1.8.0
South==0.8.4
sqlparse==0.3.0
sqreen==1.13.3
static==1.1.1
static3==0.5.1
ua-parser==0.8.0
urllib3==1.24.1
user-agents==1.1.0
wh==1.2.0
whitenoise==1.0.6
wrapt==1.11.1
xkcdpass==1.2.5

is there something I've missed? im assuming its a python 3 issue

Upvotes: 0

Views: 186

Answers (1)

dirkgroten
dirkgroten

Reputation: 20682

The version of paramiko (1.15.2) isn't compatible with python 3.7. Use a newer version. It uses the async keyword which is reserved as argument in a function call.

If you look at the latest version, you'll see that this particular line of code is now using async_.

You should always use the same version of python on your local machine as on production to spot these errors earlier.

I also suggest you look at some of the other dependencies, your version of gunicorn is also more than 5 years old, it contains security vulnerabilities, so may some other (old) packages you're using.

Finally, use pip freeze to compare what's installed in your local virtualenv compared to requirements.txt. And make sure they are the same!

Upvotes: 1

Related Questions