Scrapy push to Heroku get error: Push rejected, failed to compile Python app

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Scrapy push to Heroku get error: Push rejected, failed to compile Python app



I have s scrapy project can crawl data and save to mongodb. I want to deploy it to Heroku.



I take a reference from Scrapy official website https://support.scrapinghub.com/support/solutions/articles/22000216178-scrapy-cloud-vs-scrapyd-using-heroku-



I add requirements.txt:


pymongo==3.5.1
Scrapy==1.4.0
scrapyd==1.0.1
scrapy-heroku==0.7.1



scrapy.cfg:


[settings]
default = MyMovies.settings

[scrapyd]
application = scrapy_heroku.app.application

[deploy]
#url = http://localhost:6800/
url = http://moviescrapy.herokuapp.com:80/
project = MyMovies
username = <My Heroku account>
password = <My Heroku password>



Procfile:


web: scrapyd



When type git push heroku master on terminal.


git push heroku master



I get the error finally:


remote: AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-oj017as5/distribute/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to moviescrapy.
remote:
To https://git.heroku.com/moviescrapy.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/moviescrapy.git'



I think i have follow the official tutorial, why i still get the error ?



Should i add distribute somewhere ?


distribute



What step i miss it ? Any help would be appreciated. Thanks in advance.




1 Answer
1



It's because scrapy-heroku does not support python-3 instead use python-2 as a environment.





Thanks for your reply, but my python environment is 2.7.
– 徐博俊
Aug 13 at 5:50





I too had a similar problem what i do, i add a runtime.txt and in it i mention ('python-2.7.15') and it worked for me
– Shubham Jain
Aug 14 at 9:01





Do you mean add it in requirements.txt or another file runtime.txt ? Can you show the file content if you mean add it in runtime.txt. Thanks you.
– 徐博俊
Aug 14 at 9:38


requirements.txt


runtime.txt


runtime.txt





Make another file name runtime.txt and let me know if you have any problem
– Shubham Jain
Aug 14 at 12:18





I find the information devcenter.heroku.com/articles/python-runtimes from your answer and it is working now. Thank you very much @Shumbham !
– 徐博俊
Aug 15 at 2:42






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard